bernardsylunar
Programmer
hi everyone!
i'm new to Visual C++ and i try to create my own dll and call it from my Visual Basic 6.0 program. i've created a function IsStringEqual that will check if the two strings are equal. here's my code...
In Visual C++
int _stdcall IsStringEqual(char string1, char string2, int discardCase)
{
if (discardCase == 1)
{
string1 = tolower(string1);
string2 = tolower(string2);
}
if (string1 == string2)
return 1;
else
return 0;
}
In Visual Basic
Private Declare Function IsStringEqual Lib "E:\ynad\personal\program\vc++\MyDll\Release\MyDll.dll" (ByVal String1 As Any, ByVal String2 As Any, ByVal discardCase As Integer)
Private Sub Command1_Click()
Dim i
i = IsStringEqual(Text1.Text, Text2.Text, 0)
Debug.Print i
End Sub
-------------------------------------
everytime i run my visual basic project and click the command button there's always an error message 'Bad DLL calling convention'. i try to remove the _stdcall there's always the same error that i've encountered.
pls help...
thanks in advance
ynad
----
It is foolish to listen to someone who will not listen to you.
i'm new to Visual C++ and i try to create my own dll and call it from my Visual Basic 6.0 program. i've created a function IsStringEqual that will check if the two strings are equal. here's my code...
In Visual C++
int _stdcall IsStringEqual(char string1, char string2, int discardCase)
{
if (discardCase == 1)
{
string1 = tolower(string1);
string2 = tolower(string2);
}
if (string1 == string2)
return 1;
else
return 0;
}
In Visual Basic
Private Declare Function IsStringEqual Lib "E:\ynad\personal\program\vc++\MyDll\Release\MyDll.dll" (ByVal String1 As Any, ByVal String2 As Any, ByVal discardCase As Integer)
Private Sub Command1_Click()
Dim i
i = IsStringEqual(Text1.Text, Text2.Text, 0)
Debug.Print i
End Sub
-------------------------------------
everytime i run my visual basic project and click the command button there's always an error message 'Bad DLL calling convention'. i try to remove the _stdcall there's always the same error that i've encountered.
pls help...
thanks in advance
ynad
----
It is foolish to listen to someone who will not listen to you.