View Full Version : Need to convert STRING to OLECHAR ...

11-03-2003, 12:15 PM

I need to access COM+ to add a package myself, in install script.
It should work, but I just found out that I need to pass strings as OLECHAR * types.

Does anyone know if I can do this in InstallScript ?
Or will I need a Windows API ?

Will this work ?


11-04-2003, 03:35 PM

This should work properly in InstallScript, though you will probably have to pass the address of the string in the call (i.e.)

string szString;

set oObject = CoCreateObject( "MyObject");

Devin Ellingson
InstallShield Software Corporation

11-04-2003, 04:13 PM
Nope, it doesn't work ;-(

I now think that I could (should) use unicode strings on the methods of comadmin.dll

So I am now trying to do something that worked well in a C .DLL.

But it doesn't work in install script ! Why ?

"unicode" text is always empty "" ...

prototype long kernel32.MultiByteToWideChar(long, long, pointer, long, pointer, long);

function string StringToUnicode(str)
string unicodeStr;
long len;
len = kernel32.MultiByteToWideChar(CP_ACP, 0, &str, -1, NULL, 0);
kernel32.MultiByteToWideChar(CP_ACP, 0, &str, -1, &unicodeStr, len);
MessageBox(unicodeStr, INFORMATION);

return unicodeStr;

11-05-2003, 10:45 AM
InstallScript now has a WSTRING/wstring data type for storing Unicode strings; perhaps try using that?

11-05-2003, 10:59 AM
Thanks I'll try it. So I can just assign a normal string to a wstring and it will be converted ? Or is there a conversion function somewhere ?

11-05-2003, 11:12 AM
Nope doesn't seems to work. The wstring seems to be ok, but comadmin still won't accept what I give him...

(And it worked when in VB)

Time to code that in C.