cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FlankeD
Level 3

Help with AddFolderIcon

Hi,
On the function OnFirstUIAfter, i created a custom dialog to allow the end-user to add or not a desktop shortcut.
The dialog contains a checkbox. Everything is working fine, but for an unknown reason, LongPathToQuote doesn't seem to add quotation marks. This make my shortcut not working.

anyone knows what i'm doing wrong. The shortcut is only executing the .exe the install create.

The path itself is ok, only the quotation mark missing.

I've put message box before and after to check if it was changing anything.


#define CD_CUSTOMENDING "CustomEnding"
#define CD_CUSTOMENDINGID 1337
#define CD_CBOX_SHORTCUT 33

#define PROGRAM TARGETDIR ^ "Jnes.exe";


szDlg = CD_CUSTOMENDING;

szProgramFolder = FOLDER_DESKTOP;
szItemName = "xxxx";
szProgram = PROGRAM;
MessageBox(szProgram,SEVERE);
LongPathToQuote(szProgram,FALSE);
szCommandLine = szProgram;
szWorkingDir = "";
szIconPath = SRCDIR ^ "xxx.ico";
nIcon = 0;
szShortCutKey = "";
MessageBox(szProgram,SEVERE);



if (EzDefineDialog( szDlg, "", "", CD_CUSTOMENDINGID ) = DLG_ERR) then
MessageBox("Not able to load CustomEnding Dialog", SEVERE);
abort;
endif;

// Disable( BACKBUTTON );

while(!bDone)
nCmdValue = WaitOnDialog(szDlg);

switch(nCmdValue)

case DLG_INIT:
hwndDlg = CmdGetHwndDlg(szDlg);
SetWindowText(hwndDlg,"xxxx - InstallShield Wizard");

case IDCANCEL:
Do(EXIT);


case SD_PBUT_CONTINUE:
bDone = TRUE;

if (CtrlGetState( szDlg, CD_CBOX_SHORTCUT) = BUTTON_CHECKED) then

//Insert shortcut here
if (AddFolderIcon (szProgramFolder, szItemName, szCommandLine, szWorkingDir,
szIconPath, nIcon, szShortCutKey, REPLACE) < 0) then

MessageBox ("AddFolderIcon failed.", SEVERE);

endif;
Labels (1)
0 Kudos
(3) Replies
FlankeD
Level 3

nevermind, i found the problem, i feel so stupid...


LongPathToQuote(szProgram,FALSE);

needs to be at true.....

Works fine now.
0 Kudos
Dan_Galender
Level 10

The second argument to LongPathToQuote should be TRUE if you want quotes added to the path. FALSE removes them.
0 Kudos
RobertDickau
Flexera Alumni

What if you set the second argument of LongPathToQuote to TRUE? The documentation has more information.

(As an aside, SdFinish has an option to display a check box, and there are other check box dialog boxes, so perhaps you could get by without a custom dialog...)
0 Kudos