ginaa
asked on
pass char string from VB6 to VC6 dll?
Finally I can call VC6.0 dll function from VB6.0
I can send and get numerical data to dll.
But for char string data, it always fail.
Any one can give the samples for that?
Thank
ginaa
I can send and get numerical data to dll.
But for char string data, it always fail.
Any one can give the samples for that?
Thank
ginaa
No time to Program, I think your parameter's type Must be BSTR
Declare the String as BSTR in the exported function in VC++. In vb, when you define the function, string variables should be declared ByVal.
In your C++ funtion you should be able to explicitly type-cast the BSTR to LPCTSTR (or LPTSTR). From then on you should be OK...
In your C++ funtion you should be able to explicitly type-cast the BSTR to LPCTSTR (or LPTSTR). From then on you should be OK...
ASKER
Sorry, I don't say clear enough.
1. I used VC environment but I just write C program, not use MFC.
2. I declare in dll function use (char *) and I write another C program link with this dll. The string transfer is OK.
3. I got compile error : undeclared identifier for BSTR, LPTSTR.....
So, I miss anything?
Can you answer me again
Regards
Ginaa
1. I used VC environment but I just write C program, not use MFC.
2. I declare in dll function use (char *) and I write another C program link with this dll. The string transfer is OK.
3. I got compile error : undeclared identifier for BSTR, LPTSTR.....
So, I miss anything?
Can you answer me again
Regards
Ginaa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DLL Created Function in Visual C/C++:
#define NOMANGLE
long NOMANGLE _stdcall OpenTIFF(HWND hWnd, char *FileName);
VB Version of the Function Call:
Declare Function OpenTIFF Lib "MSIHead" (ByVal hWnd As Long, ByVal TIFFFilename As String) As Long
#define NOMANGLE
long NOMANGLE _stdcall OpenTIFF(HWND hWnd, char *FileName);
VB Version of the Function Call:
Declare Function OpenTIFF Lib "MSIHead" (ByVal hWnd As Long, ByVal TIFFFilename As String) As Long
ASKER
It's OK now, LPSTR still undeclared identifier.
But char* is OK.
Thanks
Ginaa
But char* is OK.
Thanks
Ginaa