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: strings in c++ dll (unicode dll with visual c++)
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
‎May 20, 2010
11:10 AM
strings in c++ dll (unicode dll with visual c++)
Hello every body,
(Sorry for my bad english... :rolleyes: )
I'm trying to use a funtion which is in my c++ dll.
If my function is something like that :
Everything is ok.
So the link between my dll and my InstallShield project is ok.
But if my function use "string" instead of int :
There is a problem :
I use this dll in a custom action created with the wizard :
I have done very much searches about this problem. I have understood that my dll must be done in unicode to accept strings. But I don't know how I can do that with visual C++ (I have done this dll myself and I can change it if it's necessary)
Is there someone who can help me to do a good dll with VisualStudio c++ in order to use it (with strings) in InstallShield ?
Thank you.
(Sorry for my bad english... :rolleyes: )
I'm trying to use a funtion which is in my c++ dll.
If my function is something like that :
int nameFunc (int myValue)
{
return myValue;
}
Everything is ok.
So the link between my dll and my InstallShield project is ok.
But if my function use "string" instead of int :
string nameFunc (string myValue)
{
return myValue;
}
There is a problem :
the dll being called encountered a problem
I use this dll in a custom action created with the wizard :
-> name
-> call a function in a standard dll
-> stored in a binary table
-> function def :
* name = nameFunc
* argument :
* return type = STRING
* returnproperty = RESULT
* argument :
Type = STRING ;
Source = InProperty ;
Value = COMPANYNAME
Source = InProperty ;
Value = COMPANYNAME
* return type = STRING
* returnproperty = RESULT
I have done very much searches about this problem. I have understood that my dll must be done in unicode to accept strings. But I don't know how I can do that with visual C++ (I have done this dll myself and I can change it if it's necessary)
Is there someone who can help me to do a good dll with VisualStudio c++ in order to use it (with strings) in InstallShield ?
Thank you.
(24) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 14, 2010
09:02 AM
Hi MrTree,
Yes I attach a zip with 3 elements :
- my dll
- my visual studio project (for the DLL) with the code
- my IS project
I had try your code, but I think our parameters are differents in the visual studio project.
(I had try with your dll, do you remember?)
So I have decided to stop my search about this probleme. I will change the process of my installation to use only numbers instead of strings. (I will use a code as result of my dll function, and in IS, I will "traduct" this code to know what to do)
Thank you very much for your help.
Yes I attach a zip with 3 elements :
- my dll
- my visual studio project (for the DLL) with the code
- my IS project
I had try your code, but I think our parameters are differents in the visual studio project.
(I had try with your dll, do you remember?)
So I have decided to stop my search about this probleme. I will change the process of my installation to use only numbers instead of strings. (I will use a code as result of my dll function, and in IS, I will "traduct" this code to know what to do)
Thank you very much for your help.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 14, 2010
10:17 AM
You attached a Zip with three folders, each of them include annother zip with only one file. The .sln (only the visual studio solution, no source), the dll itself and the .ism (the Installshield solution)
I attached my dll (the whole VS Project) with annother function, it works for me in Installscript MSI with these calls:
Methods:
I attached my dll (the whole VS Project) with annother function, it works for me in Installscript MSI with these calls:
// DLLTest
stmp = "something";
pFilename = &stmp;
stmp = CheckGetStringFromDll(pFilename);
MessageBox(stmp, INFORMATION);
nResult = CheckGetNumberFromDll(5);
NumToStr(stmp, nResult);
MessageBox(stmp, INFORMATION);
Methods:
function STRING CheckGetStringFromDll(sTemp)
int nResult;
STRING ret;
STRING test;
begin
nResult = UseDLL("C:\\Temp\\IsHelp.dll");
if(nResult != 0) then
MessageBox("Unable to load IsHelp.dll.", SEVERE);
exit;
endif;
ret = GetStringFromDll(sTemp);
UnUseDLL("C:\\Temp\\IsHelp.dll");
return ret;
end;
prototype NUMBER IsHelp.GetNumberFromDll(NUMBER);
export prototype NUMBER CheckGetNumberFromDll(NUMBER);
function NUMBER CheckGetNumberFromDll(nTemp)
NUMBER nResult, ret;
begin
nResult = UseDLL("C:\\Temp\\IsHelp.dll");
if(nResult != 0) then
MessageBox("Unable to load IsHelp.dll.", SEVERE);
exit;
endif;
ret = GetNumberFromDll(nTemp);
UnUseDLL("C:\\Temp\\IsHelp.dll");
return ret;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 14, 2010
11:06 AM
Hi,
:rolleyes: I thought that the .sln contain sources too, sorry.
The difference between your IS project and mine is that mine isn't InstallScript project but Basic MSI project. And I can't change that.
Today, I have done the other solution with numbers intead of strings. I think every thing would be ok.
Thank you very much for your help MrTree.
Have a nice day
:rolleyes: I thought that the .sln contain sources too, sorry.
The difference between your IS project and mine is that mine isn't InstallScript project but Basic MSI project. And I can't change that.
Today, I have done the other solution with numbers intead of strings. I think every thing would be ok.
Thank you very much for your help MrTree.
Have a nice day
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 07, 2015
09:49 AM
This didn't work for me in InstallShield 2013. Here's what did:
http://stackoverflow.com/questions/31215110/how-do-i-return-a-unicode-string-wstring-cstringw-from-a-c-dll-to-installs/31251799#31251799
http://stackoverflow.com/questions/31215110/how-do-i-return-a-unicode-string-wstring-cstringw-from-a-c-dll-to-installs/31251799#31251799