Archive: A question regarding passing a string to a dll


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.


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


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.