Visual Basic -->> C++ DLL 
Author Message
 Visual Basic -->> C++ DLL

I'm developing a series of C++ functions using Borland 4.0. I
intend to place these in a DLL so that I can access them from
a Visual Basic ( actually it's a derivative of VB - but close
enough.. ) program.  

I need some help ( i.e. examples ) in declaring my C++
functions so that I can call them properly from VB.  I've made
some tests to try to get things "talking", and the numbers that
are returned are all garbage ( on the order of E-200 or E300 etc).  

In my VB program, I am passing everything using the ByVal
parameter and am using floats for all of the type declarations,
(both in C++ and VB).

Can I get some hints/help?

-Mike

--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


_/_/_/_/_/   http://www.*-*-*.com/ ~md064291  _/_/_/_/_/

--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


_/_/_/_/_/   http://www.*-*-*.com/ ~md064291  _/_/_/_/_/



Tue, 02 Sep 1997 09:58:22 GMT  
 Visual Basic -->> C++ DLL
: I need some help ( i.e. examples ) in declaring my C++
: functions so that I can call them properly from VB.  I've made
: some tests to try to get things "talking", and the numbers that
: are returned are all garbage ( on the order of E-200 or E300 etc).  

: In my VB program, I am passing everything using the ByVal
 : parameter and am using floats for all of the type declarations,
: (both in C++ and VB).

Maybe your problem is an incompatibility between VB's float data type and C's
float data types.
To check this, you could simply create a file in VB and write a float to it.
Then you load that same file in C++, read the float and see if C++
recognizes it as the same number.
If the numbers are different, then you have an incompatibility problem and  
should use a different data type (perhaps currency, which won't allow huge
numbers but at least are easy to decode in C++ - it's just a 64-bit integer
divided by 10,000.)

Hope this will help.

--
Fabio Cereda



Wed, 03 Sep 1997 05:52:25 GMT  
 Visual Basic -->> C++ DLL
seeing that I have TC++/win and the appropriate liscense, I was curious
about using BWCC.DLL in Vb.  

I was wondering if anyone has done this and how so?
thanx



Wed, 03 Sep 1997 08:44:49 GMT  
 Visual Basic -->> C++ DLL
Can BWCC be used in a VB app? If so, what are the declarations/functions of
it?

--
--------------------------------------------------------------------

--------------------------------------------------------------------



Fri, 05 Sep 1997 10:07:36 GMT  
 Visual Basic -->> C++ DLL

Quote:

>Path:
>ottnews!tornews!shlnews!uunet!usc!howland.reston.ans.net!ix.netcom.com!netnews

>Newsgroups: comp.lang.basic.visual.misc
>Subject: Re: BWCC.DLL
>Date: 21 Mar 1995 01:51:19 GMT
>Organization: Netcom
>Lines: 52
>Distribution: world



>NNTP-Posting-Host: ix-har1-08.ix.netcom.com
>Could you please send your declare statement?

Add this function declaration the the general declarations section of a form, or in a .BAS file
if you are declaring other Windows API functions.

Declare Function BWCCMessageBox Lib "BWCC.DLL" (ByVal hWnd As Integer, ByVal Message As String,
ByVal Caption As String, ByVal Style As Integer) As Integer

' hWnd        Windows Handle Of Parent Form
' Message     The message text for the Message Box
' Caption     The "Title" of the Message Box
' Style       The type of Icon(s) to display i.e IconStop & OK button

Add this code to a form for a quick example of the BWCC Message Box...

Sub Command1_Click ()
Dim X%
'The 16 for the Style value equates to  MB_ICONSTOP with an OK button
'NOTE: If you include an icon in your message box, you reduce the amount of space in
'the message box to display text.

    X% = BWCCMessageBox(((Me.hWnd)), "This is a Borland Style Message Box with
an Icon", "Borland Message Box", 16)
    X% = BWCCMessageBox(((Me.hWnd)), "This is a Borland Style Message Box
without an Icon", "Borland Message Box", 0)

End Sub

If you want to see what other functions are enclosed in BWCC, go to the CICA
ftp site (or a mirror site). Look in the "/pub/cica/pc/win3/programr/bcpp"
directory (may differ from site to site) and get BWCC.ZIP.  This file includes
the C/C++ header file for BWCC.DLL

Brad.
------------------------------------------------------
Opinions expressed are my own and do not represent the
views of the company.



Sun, 07 Sep 1997 01:08:33 GMT  
 Visual Basic -->> C++ DLL

Quote:
>Can BWCC be used in a VB app? If so, what are the declarations/functions of
>it?

Yes it can.  Use

declare function BWCCMessageBox Lib "BWCC.DLL" ( byVal hWndParent as integer, _
        byVal lpCaption as string, byVal lpText as string, byVal wType as integer) as Integer

That will give you the dialog box.  You will have to mess with the numbers on the last
param to get the correct settings you want.

//-------------------------------------------------------------

//   Team OS/2
//-------------------------------------------------------------



Tue, 09 Sep 1997 12:53:06 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Excel->VBA->Help->Visual Basic Help

2. Visual C++ ------> Visual Basic

3. C++ To Q(uick)BASIC (>>)

4. <<<<<<<<ComboBox>>>>>>>>>>>>

5. using The Shell Command >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

6. >>>>>>While Not rst.EOF

7. PSUDOCODE HELP >>>>>>>>>>>

8. <JOB>C++/Java/ or Visual Basic Engineers

9. <JOB>C++/Java/ or Visual Basic Engineers

10. Visual Basic -> C++ Converter

 

 
Powered by phpBB® Forum Software