I'd like to make a function like SprintfBox which has optional parameters. How might I go about doing this?
By the way, the help states the SprintfBox definition as being the following:
SprintfBox (nType, szTitle, szFormat [,arg] [,...]);
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Creating Function with Optional Parameters
Started by
Taco Bell
, Sep 12 2002 20:50
5 replies to this topic
Posted 13 September 2002 - 08:08
How about using an array as argument?
First prepare an array, resize it, fill it. Then hand it over to the function. The function gets its size with SizeOf() and can retrieve the elements.
Eberhard
First prepare an array, resize it, fill it. Then hand it over to the function. The function gets its size with SizeOf() and can retrieve the elements.
Eberhard
Posted 13 September 2002 - 15:22
Yeah, I could use an array, but that requires the parameters to all be of the same type.
I found a different workaround and actually don't have to figure this out anymore, but it would be nice to know still for future reference.
I found a different workaround and actually don't have to figure this out anymore, but it would be nice to know still for future reference.
Posted 14 September 2002 - 00:32
Overloaded functions like SprintFBox are common in C++, but I think InstallShield identifies user functions only by their name, not the parameters (no name mangling), so you can't overload them.
You might be able to do this by coding your function in a DLL, but install shield might still reject the header file.
You might be able to do this by coding your function in a DLL, but install shield might still reject the header file.
Posted 14 September 2002 - 01:45
Yeah, I think you're right prozacrefugee. I tried making functions with the same name before, but a differing number of parameters and the compiler barked at me each & every time. Oh well.
Out of curiousity, does anyone know if MSI allows/supports this? Especially since someday, I'm expecting to be forced to move over to it.
Out of curiousity, does anyone know if MSI allows/supports this? Especially since someday, I'm expecting to be forced to move over to it.
Posted 15 September 2002 - 18:45
MSI doesn't support custom functions, but custom scripts. These can be written in VBScript, JScript, DLL or EXE (or with InstallShield in InstallScript). Not sure if VBScript or JScript support this.
Stefan Krüger
InstallSite.org twitter facebook