I resolved seeing on
https://stackoverflow.com
the problem was the parameters give to exe
I correct your source
see
aShortCut:Arguments := cArguments
#include "FiveWin.ch"
// creare le icone sul desktop
#define HKEY_CURRENT_USER 2147483649
#define HKEY_LOCAL_MACHINE 2147483650
FUNCTION Main()
Local cTitle := "EasyBus 1.00"
Local cFile := 'C:\work\errori\tavoli\test.exe'
]Local cArguments := "1024 700"
Local cWorkingDirectory := 'C:\work\errori\tavoli\'
Local cIconPath := 'C:\work\errori\tavoli\bus.ico'
Local cDescription := "EasyBus 1.00"
Local nWindowsStyle := 6
CreateIconeDesktop(cTitle,cFile,cDescription,cArguments,cIconPath,cWorkingDirectory,nWindowsStyle)
RETURN NIL
//------------------------------------------------------------------------------------------------//
Function CreateIconeDesktop(cTitle,cFile,cDescription,cArguments,cIconPath,cWorkingDirectory,nWindowsStyle)
LOCAL aShortCut, oWSHShell, strDesktop := ""
oReg := TReg32():New( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" )
strDesktop := oReg:Get("Desktop")
oReg:Close()
IF LEFT(strDesktop,1) == "%"
strDesktop := GETENV('USERPROFILE') + "\Desktop\"
ENDIF
IF FILE( strDesktop + "\" + cTitle + ".lnk" )
RETURN NIL
ENDIF
IF !MsgYesNo( "Non è stato trovato nella icona di sistema desktop" + CRLF + CRLF + "Desideri crearlo ora ?", "Attenzione" )
RETURN NIL
ENDIF
TRY
oWSHShell := CreateObject( "WScript.Shell" )
CATCH error
MsgStop( "Impossibile creare l'icona di sistema sul desktop !", "Errore" )
RETURN .F.
END TRY
aShortCut := oWSHShell:CreateShortcut( strDesktop + "\" + cTitle + ".lnk" )
IF !Empty( nWindowsStyle )
aShortCut:Description := cDescription
Endif
IF !Empty( nWindowsStyle )
aShortCut:WindowStyle := nWindowsStyle
else
aShortCut:WindowStyle := 4
Endif
IF !Empty( cIconPath )
aShortCut:IconLocation := cIconPath
Endif
IF !Empty( cWorkingDirectory )
aShortCut:WorkingDirectory := cWorkingDirectory
Endif
aShortCut:TargetPath := cFile
If !empty(cArguments)
aShortCut:Arguments := cArguments
Endif
aShortCut:Save()
RELEASE oWSHShell
RELEASE aShortCut
RETURN .T.
//--------------------------------------------------------------------------------------------------------//
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com