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: Problem using ANSI tring for folder path in Installshield 2011
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
‎Oct 31, 2011
12:32 AM
Problem using ANSI tring for folder path in Installshield 2011
Hi ,
We have encountered an issue after we upgraded our Install Shield version to 2011 and migrated our project from 2009 to 2011. The issue description as below...
In Install shield project we have an option that the user can choose to install to a different path than the default path. In the script we have a method to change the installation path which intern calls a method written in Delphi. The Delphi method returns changed installation path as string which is assigned to a variable in Install Script defined as STRING and later assigned to INSTALLDIR and TARGETDIR. While Installing, after changing the installation path its displaying the changed path in junk characters.
can any one suggest regarding this issue. we are unaware of how to use the ANSI string returned from DLL(written in Delphi) in the install script as it is without converting it to unicode characters.
We also tried returning unicode(WidePChar) string from Delphi code but of no use.
Thanks,
Shijat.
We have encountered an issue after we upgraded our Install Shield version to 2011 and migrated our project from 2009 to 2011. The issue description as below...
In Install shield project we have an option that the user can choose to install to a different path than the default path. In the script we have a method to change the installation path which intern calls a method written in Delphi. The Delphi method returns changed installation path as string which is assigned to a variable in Install Script defined as STRING and later assigned to INSTALLDIR and TARGETDIR. While Installing, after changing the installation path its displaying the changed path in junk characters.
can any one suggest regarding this issue. we are unaware of how to use the ANSI string returned from DLL(written in Delphi) in the install script as it is without converting it to unicode characters.
We also tried returning unicode(WidePChar) string from Delphi code but of no use.
Thanks,
Shijat.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 31, 2011
04:16 PM
Hi,
I'm having the same problem as yours when I tried to migrate to IS 2012 from IS 2010. DLL function returns garbage values in my InstallScript. I fixed it by converting my DLL to a unicode format.
For example:
instead of using LPCSTR for accepting strings I used LPCWSTR instead like below:
LPCWSTR function()
{
LPCWSTR msg= L"Hello World";
MessageBoxW(NULL,msg,L"Message",MB_OK);
return msg;
}
I'm having the same problem as yours when I tried to migrate to IS 2012 from IS 2010. DLL function returns garbage values in my InstallScript. I fixed it by converting my DLL to a unicode format.
For example:
instead of using LPCSTR for accepting strings I used LPCWSTR instead like below:
LPCWSTR function()
{
LPCWSTR msg= L"Hello World";
MessageBoxW(NULL,msg,L"Message",MB_OK);
return msg;
}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 31, 2011
05:39 PM
I don't know quite enough about Delphi, but if it exports C-style functions, you just have to be careful to indicate whether you're passing an ANSI character string (or buffer) around, or a Unicode character string (or buffer). You do this in InstallScript by specifying STRING or WSTRING respectively in the extern prototype, and explicit suffixing of function names if you need SomeFunctionA instead of SomeFunctionW. If you haven't already done so, check out the information in the sticky of this forum, but it doesn't talk specifically about Delphi either.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 01, 2011
01:52 AM
Thanks MichaelU & cydz1985 for quick reply.
we tried using unicode strings in Delphi code also, but didnt found any solution if any familiar with Delphi also Please provide some more information.
Thanks & Regards,
Shijat.
we tried using unicode strings in Delphi code also, but didnt found any solution if any familiar with Delphi also Please provide some more information.
Thanks & Regards,
Shijat.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 02, 2011
06:05 AM
Thanks cydz1985,
We changed all the Delphi code to support unicode and its working fine now.
Previously when we changed the code to support unicode didnt changed the Install script code from BYVAL STRING TO BYVAL WSTRING.
Now every thing is working fine.
Thanks,
Shijat.
We changed all the Delphi code to support unicode and its working fine now.
Previously when we changed the code to support unicode didnt changed the Install script code from BYVAL STRING TO BYVAL WSTRING.
Now every thing is working fine.
Thanks,
Shijat.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 06, 2012
06:16 AM
I am also facing the same situation using C++ dll.
Isn't there a solution other than converting the dll into unicode?
Isn't there a solution other than converting the dll into unicode?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 06, 2012
09:30 AM
The answer to that depends on the problems you are trying to solve. If it's a matter of passing data between InstallScript and C++, you just need to ensure that your functions are declared correctly (extern prototype ... using STRING or WSTRING depending on your dll). If you need to support characters other than those available on your code page, you need to use Unicode strings and functions. Neither of these strictly require compiling your DLL as Unicode, but I would suggest doing so for the latter case.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)