Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / November 2003



Tip: Looking for answers? Try searching our database.

Sharing the same VB DLL\EXE between a C++ DLL and a VB Active EXE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Guilbert - 21 Nov 2003 12:48 GMT
Hi,

I am having a problem in that I need to create a
shared VB DLL\Active EXE for both a C++ DLL and a VB EXE/DLL to share
the same variable values. I would be
very grateful if someone could just provide an example in format as
follows:-

Shared VB DLL (Class):
**********************

Public intSharedVariable as Integer

c++ dll
**********************

bla bla bla (update and display variable)

VB EXE/DLL
*************

bla bla bla (update and display variable)

I have tried using import and set my shard VBDLL to 'GlobalMultiUse',
but they each still use different instances/memory. Maybe my set-up is
wrong?

Anyones help would be much appreciated. Been a while out of C++ now...

Thanks,

John Guilbert.
John Guilbert - 26 Nov 2003 12:58 GMT
This is now solved.

Problem:

Needed to share Visual Basic DLL variable values with C++ (i.e. Global
Variables).

Resolution:

NEW Intermediate C++ DLL
Created an intermediate C++ DLL with the SetSharedMem and GetSharedMem
functions (browse the web for the C/C++ DLL code). Must export
functions setsharedmem and getsharedmem as _stdcall functions.

C++ DLL
In main C++ dll I loaded the intermediate C++ DLL (ensuring to use the
_stdcall in the procedure definitions for GetProcAddress - this is
what caused the problem). Example: typedef VOID (_stdcall
*SETSHAREDMEM)(LPTSTR);

VB DLL
Use Declare statement (all parameters as BYVALS) to get the two
functions; getsharedmem and setsharedmem.

EASY.......

Hope this helps anyone.

John.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.