October 30, 2025, 05:37:09 PM

News:

IWBasic runs in Windows 11!


Deleting a shortcut from the Start Menu

Started by Andy, February 21, 2012, 01:22:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

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.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

ckoehn

I use the Create Install Free.  It work good for me.

Later,
Clint