IonicWind Software

IWBasic => General Questions => Topic started by: Andy on February 21, 2012, 01:22:51 AM

Title: Deleting a shortcut from the Start Menu
Post by: Andy on February 21, 2012, 01:22:51 AM
Hi,

Just cleaning up my project, I used the Shell_Comm example to create an entry in the 'All Programs' list
but I can't seem to remove the link when I run the uninstall program.

So, in the All Programs list I have a folder, and within the folder I have the link to my program, any ideas how to delete these entries?

The folder is called 'Safe_Browser' and the link is 'Safe_Browser.lnk'.

Thanks,
Andy.

Title: Re: Deleting a shortcut from the Start Menu
Post by: Andy on February 22, 2012, 12:21:12 AM
Found it!


DEF bk$,str,str3:string
bk$ = CHR$(92)

DECLARE "kernel32",Sleep(dwMilliseconds:INT)

desktopPath = GetFolderLocation(0x0017)
str = ""
'Destination
l = len(desktopPath)
for xd = 1 to l
t = MID$(desktopPath,xd,1)
IF t = bk$
str = str + t + bk$
ELSE
str = str + t
ENDIF
NEXT xd

str = str + bk$ + bk$ + "Safe Browser"
str3= str + bk$ + bk$ + "Safe Browser.lnk"

OPENCONSOLE
PRINT
PRINT str
PRINT
PRINT str3

DELETEFILE str3
sleep(500)
REMOVEDIR str
END

CONST CSIDLDESKTOP = 0x0000
CONST CSIDLPROGRAMS = 0x0002
CONST CSIDLCONTROLS = 0x0003
CONST CSIDLPRINTERS = 0x0004
CONST CSIDLPERSONAL = 0x0005
CONST CSIDLFAVORITES = 0x0006
CONST CSIDLSTARTUP = 0x0007
CONST CSIDLRECENT = 0x0008
CONST CSIDLSENDTO = 0x0009
CONST CSIDLBITBUCKET = 0x000a
CONST CSIDLSTARTMENU = 0x000b
CONST CSIDLDESKTOPDIRECTORY = 0x0010
CONST CSIDLDRIVES = 0x0011
CONST CSIDLNETWORK = 0x0012
CONST CSIDLNETHOOD = 0x0013
CONST CSIDLFONTS = 0x0014
CONST CSIDLTEMPLATES = 0x0015
CONST CSIDLCMNSTARTMENU = 0x0016
CONST CSIDLCMNPROGRAMS = 0x0017
CONST CSIDLCMNSTARTUP = 0x0018
CONST CSIDLCMNDESKTOPDIRECTORY = 0x0019
CONST CSIDLAPPDATA = 0x001a
CONST CSIDLPRINTHOOD = 0x001b

DECLARE IMPORT,SHGetSpecialFolderLocation(hwnd as UINT,nFolder as INT,ppITEMIDLIST as POINTER),int
DECLARE IMPORT,SHGetPathFromIDList(pITEMIDLIST:POINTER,PATH:STRING),int
DECLARE IMPORT,CoTaskMemFree(pidl:POINTER)

SUB GetFolderLocation(nFolder:INT),STRING
     DEF path[260]:ISTRING
     DEF pidl:POINTER
     DEF ppidl:POINTER
     ppidl = &pidl
     SHGetSpecialFolderLocation(NULL,nFolder,ppidl)
     SHGetPathFromIDList(pidl,path)
     CoTaskMemFree(pidl)
RETURN path
ENDSUB

This will remove a shortcut from the 'All Programs' list, then delete the folder that contained it.

Hope this helps someone,
Andy.

Title: Re: Deleting a shortcut from the Start Menu
Post by: LarryMc on February 22, 2012, 12:25:35 AM
Glad you found the solution(and for posting it).

I use Inno Setup and Inno Tools to make my install programs and it includes the uninstall stuff.
Therefore I have never really had to worry about the details.

LarryMc
Title: Re: Deleting a shortcut from the Start Menu
Post by: Andy on February 22, 2012, 12:55:40 AM
Larry,

Thanks for that, will always share anything I find as we all help each other.

I wrote my own setup program for my project, I know I have been doing things the hard way but didn't want to use the windows installer on this project.

Will have a look at the installer you mentioned for possible future use - Thanks.

Andy.
Title: Re: Deleting a shortcut from the Start Menu
Post by: ckoehn on February 25, 2012, 12:03:16 PM
I use the Create Install Free.  It work good for me.

Later,
Clint