Creare collegamenti sul desktop
'create shortcuts on desktop and startmenu
$include "rapidq.inc"
$typecheck on
Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(lpExistingFileName As String, lpNewFileName As String, bFailIfExists As Long) As Long
Declare Sub SHAddToRecentDocs Lib "shell32.dll" alias "SHAddToRecentDocs"_
(uFlags As Long, pv As String)
Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias _
"SHGetSpecialFolderPathA" (hwndOwner As Long,byref lpszPath As String, _
nFolder As Long, fCreate As Long) As Long
declare sub button1_click
Create Form1 as qform
Height=85
Left=148
Top=90
Width=160
create Button1 as QButton
Caption="create shortcuts"
Left=6
Top=5
Width=136
onclick=button1_click
end create
end create
'----------Initaliation code-----------
Form1.Showmodal
sub button1_click
dim folder as string
dim source as string,target as string,recent as string
SHAddToRecentDocs (2,command$(0))'this file
source=command$(0)
source=source-left$(source,rinstr(source,"\"))+".lnk"
'get recent folder
folder=space$(260)
SHGetSpecialFolderPath(0, folder,CSIDL_RECENT, 0)
folder = LTrim$(folder)
recent=rtrim$(folder)+"\"+source-chr$(0)
'put on desktop
folder=space$(260)
SHGetSpecialFolderPath(0, folder,CSIDL_DESKTOP, 0)
folder = LTrim$(folder)
target=rtrim$(folder)+"\"+source-chr$(0)
target=lcase$(target)
CopyFile(recent,target,1)
'put in startmenu
folder=space$(260)
SHGetSpecialFolderPath(0, folder,CSIDL_PROGRAMS, 0)
folder = LTrim$(folder)
target=rtrim$(folder)+"\"+source-chr$(0)
target=lcase$(target)
CopyFile(recent,target,1)
end sub
|