This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Install Script STRING -> C++ DLL using UNICODE data
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 27, 2009
06:30 PM
Install Script STRING -> C++ DLL using UNICODE data
Hello,
I'm using Install Shield 2009 and have an Install Shield Install Script project to take in user entered data and pass that off to a C++ DLL to do some processing.
The STRING data type is defined as two-byte UNICODE data and I have my C++ DLL expecting two-byte UNICODE data - however if I enter in regular text 'hello' or Asian characters (on an Asian OS) I always seem to get unibyte data handed off to the C++ DLL.
I can not find a setting that specifies that encoding type of the Install Shield project, yet am at a loss to explain why I don't get two byte data representation of the user entered data.
Has anyone experienced this or can shed some guidance on what I may be doing wrong?
Thanks.
I'm using Install Shield 2009 and have an Install Shield Install Script project to take in user entered data and pass that off to a C++ DLL to do some processing.
The STRING data type is defined as two-byte UNICODE data and I have my C++ DLL expecting two-byte UNICODE data - however if I enter in regular text 'hello' or Asian characters (on an Asian OS) I always seem to get unibyte data handed off to the C++ DLL.
I can not find a setting that specifies that encoding type of the Install Shield project, yet am at a loss to explain why I don't get two byte data representation of the user entered data.
Has anyone experienced this or can shed some guidance on what I may be doing wrong?
Thanks.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 27, 2009
06:43 PM
Perhaps see if the InstallScript WSTRING data type helps?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 27, 2009
08:25 PM
RobertDickau wrote:
Perhaps see if the InstallScript WSTRING data type helps?
Works like a charm.
Thanks Robert.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 28, 2009
12:59 AM
I'm now struggling with getting UNICODE data from the C++ DLL back to Install Script.
The C++ method is declared so that it returns back multi byte text:
extern "C" wchar_t* WINAPI GetText()
{
return L"Robert";
};
The Install Script prototype is:
prototype WSTRING MyDLL.GetText();
Usage:
WSTRING szMyString;
szMyString = GetText();
However szMyString always only has 'R' as a value. Interchanging STRING for WSTRING appears not to make a difference. As well, using TCHAR* in place of wchar_t* also makes no difference (which is expected).
If I create another method in the C++ DLL which returns back CHAR * - no problems, I get "Robert" back to the Install Script member. But I would have expected that since I'm using WSTRING which is expecting two bytes per character and the C++ is returning L"" which is also two bytes per character that it should have worked.
How does one return double-byte strings from a DLL into Install Script variables?
:confused:
The C++ method is declared so that it returns back multi byte text:
extern "C" wchar_t* WINAPI GetText()
{
return L"Robert";
};
The Install Script prototype is:
prototype WSTRING MyDLL.GetText();
Usage:
WSTRING szMyString;
szMyString = GetText();
However szMyString always only has 'R' as a value. Interchanging STRING for WSTRING appears not to make a difference. As well, using TCHAR* in place of wchar_t* also makes no difference (which is expected).
If I create another method in the C++ DLL which returns back CHAR * - no problems, I get "Robert" back to the Install Script member. But I would have expected that since I'm using WSTRING which is expecting two bytes per character and the C++ is returning L"" which is also two bytes per character that it should have worked.
How does one return double-byte strings from a DLL into Install Script variables?
:confused:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 30, 2009
08:52 AM
Does it work if you return the value in place, using BYREF WSTRING on the InstallScript side of the prototype?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2009
10:01 AM
Even I have similar kinda problem...
I am using BYREF but it does not seems to be working...
Please let me know what solution you people have got..
I am using BYREF but it does not seems to be working...
Please let me know what solution you people have got..
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2009
11:02 PM
Code like this in the DLL---
---seems to work in an InstallScript project...
void __stdcall returnUnicodeInPlace(wchar_t* ws)---and this in InstallScript---
{
wsprintf(ws, L"Something");
return;
}
prototype void ReturnUnicodeToInstallScript.returnUnicodeInPlace(BYREF WSTRING);
function OnBegin( )
WSTRING w;
begin
UseDLL(SUPPORTDIR ^ "ReturnUnicodeToInstallScript.dll");
returnUnicodeInPlace(w);
MessageBox(w, INFORMATION);
UnUseDLL("ReturnUnicodeToInstallScript.dll");
end;
---seems to work in an InstallScript project...