I'm working with a quick-and-dirty installer that creates a number of shortcuts with CreateShortCut. One of the sections I have set up gives the user the option of setting the SW_SHOWMAXIMIZED flag on all of them (a horrible, horrible abuse of the system, I know 😉), but was unsatisfied with my solution. Here's what I'm using:
Section "-Default"
StrCpy $9 ""
SectionEnd
Section "Maximize"
StrCpy $9 "max"
SectionEnd
Section "Desktop Shortcut"
StrCmp $9 "max" deskMax
CreateShortCut "$DESKTOP\App.lnk" "$INSTDIR\App.exe"
Goto deskNorm
deskMax:
CreateShortCut "$DESKTOP\App.lnk" "$INSTDIR\App.exe" "" "" "" SW_SHOWMAXIMIZED
deskNorm:
SectionEnd
It works perfectly well, but it's ugly and I have to end up creating jumps and labels for each of the dozen or so shortcuts involved. What I would much prefer is something like this:
Section "-Default"
StrCpy $9 "SW_SHOWNORMAL"
SectionEnd
Section "Maximize"
StrCpy $9 "SW_SHOWMAXIMIZED"
SectionEnd
Section "Desktop Shortcut"
CreateShortCut "$DESKTOP\App.link" "$INSTDIR\App.exe" "" "" "" $9
SectionEnd
Much cleaner, no? But it doesn't work. I get a bad argument error (it's interpreting $9 literally). Same when I put the variable name in quotes. Anybody got any ideas?