Shoutbox

dll and script - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: dll and script (/showthread.php?tid=62437)

dll and script by polopt on 07-03-2006 at 04:27 PM

Hey,

Sorry for my english, i don't speak very well. I have a problem , i want  send a string to a dll, but i just catch the first character in the .dll.

code :

code:
DLLIMPORT int ConectionLog (char * name)
{
   
    MessageBox (0, name, "Hi", MB_ICONINFORMATION);

}

this code juste print the first character of the string name.

the code in script to send a string is :

code:
Interop.Call("msgplus.dll","ConectionLog", "hello"):



wha is rong widht is??

thanks for help


RE: dll and script by dramado on 07-03-2006 at 06:10 PM

the 'string' passed from the script to the dll is widechars

code:
void DLL_EXPORT ConectionLog(WCHAR* sometext)
{
MessageBoxW(0, sometext, sometext, 0);
}


code:
to convert from unicode to ansi
void DLL_EXPORT SomeFunction(WCHAR* sometext)
{
int a = SysStringLen(sometext)+1;
char *ansistr = (char*)malloc(a);
WideCharToMultiByte(CP_ACP,
                        0,
                        sometext,
                        -1,
                        ansistr,
                        a,
                        NULL,
                        NULL);
//...use the strings, then free their memory:
//delete[] ansistr;
MessageBox(0, ansistr, "hello", 0);
free(ansistr);
}



RE: dll and script by polopt on 07-03-2006 at 06:42 PM

thank's dramado, but i have a error she don't recognize the WCHAR type, i have include the wchar.h library but don't works...


It's work.... ouf...thank's dramato, i convert my string and works