May 23rd, 2002, 05:00 AM
Calling Dll function from VB
I have created a simple DLL with Win32 Application Extension Wizard. I have a a couple of function that are to called from a VB project. Thus I have set the calling convension to __stdcall in the Project Settings. In VB I have used the following syntax:
I am receving a error message saying
Private Declare Function fTest Lib "<Path of Dll>" Alias "fnTest" () as Long
Private Sub Command1_Click()
Dim r as Long
r = fTest()
I have also observed that it is DllMain call is successfull.
Error: 453 Can't Find Dll Entry Point for fnTest
Please let me know what is problem in the code. The code is below:
#define TEST_API __declspec(dllexport)
#define TEST_API __declspec(dllimport)
// This class is exported from the test.dll
TEST_API int fnTest(void);
Thanks In Advance
BOOL APIENTRY DllMain( HANDLE hModule,
MessageBox(NULL, "From Dll Main", "From Test Dll", MB_ICONASTERISK);
// This is an example of an exported function.
TEST_API int fnTest(void)
MessageBox(NULL, "Success!! Test Message", "From Test Dll", MB_ICONASTERISK);
May 23rd, 2002, 05:18 AM
If Win32 application is not your requirement.then I can help you for the above purpose by creating DLL with ATL COM and using it's functions in VB.
if that helps you then please let me know.
May 23rd, 2002, 05:31 AM
Thanks vimal naik but I do not want to use ATL COM components, because, the Dll will be used in a Programming Tool called MapBasic, which has the syntax similar to VB. One cannot use COM Components from MapBasic.
So Win32 application is my requirement.
Thanks In advance
May 23rd, 2002, 06:12 AM
I think you should use the DEF-file and specify your function there.
Otherwise you must use something like "fnTest@8" or "_fnTest@8" or "_fnTest". I do not know precisely.
DllMain @1 PRIVATE
fnTest @2 PRIVATE
Last edited by Vi2; May 23rd, 2002 at 06:15 AM.
With best wishes,
Russian Software Development Network -- http://www.rsdn.ru
Click Here to Expand Forum to Full Width