JohnChen
7th June 2011 19:19 UTC
A question regarding passing a string to a dll
Here is my NSIS code,
StrCpy $1 "test it"
System::call "MyDLL::test(t r1)"
The function test is defined in a dll MyDLL.dll written in C++ like,
void __stdcall test(LPCTSTR szTest);
However, even though I pass a string "test it", but I get "t" in the function test. It looks like I get the first character of the string instead of the whole string. If I want to get the whole string, how can I do that? Thanks.
Afrow UK
7th June 2011 20:00 UTC
Is the DLL Unicode or ANSI? You need to use m for multibyte or w for wide. t will be ANSI or Unicode depending on your NSIS compiler.
Stu
JohnChen
7th June 2011 20:12 UTC
Originally posted by Afrow UK
Is the DLL Unicode or ANSI? You need to use m for multibyte or w for wide. t will be ANSI or Unicode depending on your NSIS compiler.
Stu
You are right! I forgot to enable unicode in dll project. Thanks a lot.