Pls help: Calling C++ DLL using MFC from VB 
Author Message
 Pls help: Calling C++ DLL using MFC from VB

I need to call a DLL from my VB program that was written in C++.

I tried to register the dll with regsvr32 but I get the error: "No DLL
Register Server entry point was found".

When I attempt to call the DLL from VB6 I get a similar error:
"Can't find DLL entry point OpenNosGeo in
c:\sailbase-development\softchart-sdk\NosGeo"

Here is the simple VB test code I used to test the function "OpenNosGeo" in
the CNosDoc class:

Private Declare Function OpenNosGeo Lib
"c:\sailbase-development\softchart-sdk\NosGeo" (FileName As String,
bFastOpen As Boolean) As Boolean

Private Sub Command1_Click() 'run this code when button is clicked
Dim result As Boolean
result = OpenNosGeo("C:\SoftCht\13225", False) 'call the function in the DLL
End Sub

The author of the DLL says in his documentation: "The NosGeo.dll is a DLL
that uses dynamic linking to the MFC classes. If the MFC classes are not
already loaded then they will be required before running with NosGeo.dll".

But how can I load these classes from VB? I know that MFC means Microsoft
Foundation Classes, but where can I find these?
I have the C++ source code of the DLL, but I am not a C++ programmer, but I
could modify the code if necessary with some help.

--
Rgds,
/Ger Rietman
www.sailsoft.nl



Mon, 28 Mar 2005 15:32:14 GMT  
 Pls help: Calling C++ DLL using MFC from VB
I'm not an expert on these things, but unless the DLL is create as a COM DLL
in C++, I dont think it can be used in VB6...

CJM


Quote:
> I need to call a DLL from my VB program that was written in C++.

> I tried to register the dll with regsvr32 but I get the error: "No DLL
> Register Server entry point was found".

> When I attempt to call the DLL from VB6 I get a similar error:
> "Can't find DLL entry point OpenNosGeo in
> c:\sailbase-development\softchart-sdk\NosGeo"

> Here is the simple VB test code I used to test the function "OpenNosGeo"
in
> the CNosDoc class:

> Private Declare Function OpenNosGeo Lib
> "c:\sailbase-development\softchart-sdk\NosGeo" (FileName As String,
> bFastOpen As Boolean) As Boolean

> Private Sub Command1_Click() 'run this code when button is clicked
> Dim result As Boolean
> result = OpenNosGeo("C:\SoftCht\13225", False) 'call the function in the
DLL
> End Sub

> The author of the DLL says in his documentation: "The NosGeo.dll is a DLL
> that uses dynamic linking to the MFC classes. If the MFC classes are not
> already loaded then they will be required before running with NosGeo.dll".

> But how can I load these classes from VB? I know that MFC means Microsoft
> Foundation Classes, but where can I find these?
> I have the C++ source code of the DLL, but I am not a C++ programmer, but
I
> could modify the code if necessary with some help.

> --
> Rgds,
> /Ger Rietman
> www.sailsoft.nl



Mon, 28 Mar 2005 18:45:23 GMT  
 Pls help: Calling C++ DLL using MFC from VB
You may be right, but I am not sure either. Maybe an expert in this matter
shows up in this group?
Thanks for the response anyway.
--
Rgds,
/Ger Rietman
www.sailsoft.nl


Quote:
> I'm not an expert on these things, but unless the DLL is create as a COM
DLL
> in C++, I dont think it can be used in VB6...

> CJM



> > I need to call a DLL from my VB program that was written in C++.

> > I tried to register the dll with regsvr32 but I get the error: "No DLL
> > Register Server entry point was found".

> > When I attempt to call the DLL from VB6 I get a similar error:
> > "Can't find DLL entry point OpenNosGeo in
> > c:\sailbase-development\softchart-sdk\NosGeo"

> > Here is the simple VB test code I used to test the function "OpenNosGeo"
> in
> > the CNosDoc class:

> > Private Declare Function OpenNosGeo Lib
> > "c:\sailbase-development\softchart-sdk\NosGeo" (FileName As String,
> > bFastOpen As Boolean) As Boolean

> > Private Sub Command1_Click() 'run this code when button is clicked
> > Dim result As Boolean
> > result = OpenNosGeo("C:\SoftCht\13225", False) 'call the function in the
> DLL
> > End Sub

> > The author of the DLL says in his documentation: "The NosGeo.dll is a
DLL
> > that uses dynamic linking to the MFC classes. If the MFC classes are not
> > already loaded then they will be required before running with
NosGeo.dll".

> > But how can I load these classes from VB? I know that MFC means
Microsoft
> > Foundation Classes, but where can I find these?
> > I have the C++ source code of the DLL, but I am not a C++ programmer,
but
> I
> > could modify the code if necessary with some help.

> > --
> > Rgds,
> > /Ger Rietman
> > www.sailsoft.nl



Mon, 28 Mar 2005 19:50:18 GMT  
 Pls help: Calling C++ DLL using MFC from VB


Quote:
> I need to call a DLL from my VB program that was written in C++.

> I tried to register the dll with regsvr32 but I get the error: "No DLL
> Register Server entry point was found".

It's not  a COM server DLL.

Quote:
> When I attempt to call the DLL from VB6 I get a similar error:
> "Can't find DLL entry point OpenNosGeo in
> c:\sailbase-development\softchart-sdk\NosGeo"

The function is probably not exported correctly. VB cannot use __cdecl
exports and it can't call "mangled" exports. The person who wrote the DLL
should know what that means. Perhaps he/she can fix it for you.

. . . . . . . . . . . . . . . . . . . . . .
Klaus H. Probst, MVP
   http://www.vbbox.com/

Please post/reply to the newsgroup(s)



Tue, 29 Mar 2005 11:21:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB 5.0 calling C++ 5.0 DLL that calls winsock.dll

2. Question: Catching errors from a VB ActiveX control in Visual C++ using MFC

3. Calling a C++ DLL using vb

4. Compiling a C++ code to build a .DLL using VB Calls Question

5. Erratic behaviour of VB application while calling MFC dll

6. Calling a MFC dll in VB giving problem

7. Pls help me to convert these c++ code into vb

8. Help writing DLL for VB using C++

9. Help accessing a C++ DLL in Excel Using VB.

10. HELP: Creating DLL for VB using Borland C/C++

11. Using VB5 COM objs in C++ w/out MFC ?s

12. Using Crystal w/ MFC & C++

 

 
Powered by phpBB® Forum Software