You can try::
File: "shortcut.c"
#pragma BEGINDUMP
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <hbapi.h>
#include "hbstack.h"
#include "hbapiitm.h"
#include "winreg.h"
#include "tchar.h"
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
// #define OEMRESOURCE
#include <windows.h>
#include <shlobj.h>
#include "hbapi.h"
#include "hbapiitm.h"
#define ID_NOTIFYICON 1
#define WM_NOTIFYICON WM_USER+1000
#ifndef BIF_USENEWUI
#ifndef BIF_NEWDIALOGSTYLE
#define BIF_NEWDIALOGSTYLE 0x0040 // Use the new dialog layout with the ability to resize
#endif
#define BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#endif
// link executor *******************
void ChangePIF(LPCSTR cPIF);
HRESULT WINAPI CreateLink(LPSTR lpszLink, LPSTR lpszPathObj,LPSTR szWorkPath,LPSTR lpszIco, int nIco,LPSTR szDescription);
HB_FUNC( CREATEFILELINK )
{
hb_retnl( (LONG) CreateLink( hb_parc(1), hb_parc(2), hb_parc(3),hb_parc(4), hb_parni(5) ,hb_parc(6) ) );
}
void ChangePIF(LPCSTR cPIF)
{
UCHAR buffer[1024];
HFILE h;
long filesize;
strcpy(buffer, cPIF);
strcat(buffer, ".pif");
if ((h=_lopen(buffer, 2))>0)
{
filesize=_hread(h, &buffer, 1024);
buffer[0x63]=0x10; // Cerrar al salir
buffer[0x1ad]=0x0a; // Pantalla completa
buffer[0x2d4]=0x01;
buffer[0x2c5]=0x22; // No Permitir protector de pantalla
buffer[0x1ae]=0x11; // Quitar ALT+ENTRAR
buffer[0x2e0]=0x01;
_llseek(h, 0, 0);
_hwrite(h, buffer, filesize);
_lclose(h);
}
}
// Canviem el pif
HB_FUNC( CHANGE_PIF )
{
ChangePIF( hb_parc(1) ) ;
}
HRESULT WINAPI CreateLink(LPSTR lpszLink, LPSTR lpszPathObj,LPSTR szWorkPath,LPSTR lpszIco, int nIco,LPSTR szDescription)
{
long hres;
IShellLink * psl;
hres = CoInitialize(NULL);
if (SUCCEEDED(hres))
{
hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, ( LPVOID ) &psl);
if (SUCCEEDED(hres))
{
IPersistFile * ppf;
psl->lpVtbl->SetPath(psl, lpszPathObj);
psl->lpVtbl->SetIconLocation(psl, lpszIco, nIco);
psl->lpVtbl->SetWorkingDirectory(psl, szWorkPath);
psl->lpVtbl->SetDescription(psl,szDescription);
hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile,( LPVOID ) &ppf);
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
char appPath[MAX_PATH];
strcpy(appPath, lpszLink);
strcat(appPath, ".lnk");
MultiByteToWideChar(CP_ACP, 0, appPath, -1, wsz, MAX_PATH);
hres = ppf->lpVtbl->Save(ppf, wsz, TRUE);
ppf->lpVtbl->Release(ppf);
// modificar el PIF para los programas MS-DOS
ChangePIF(lpszLink);
}
psl->lpVtbl->Release(psl);
}
CoUninitialize();
}
return hres;
}
HB_FUNC( C_GETSPECIALFOLDER ) // Contributed By Ryszard RyRko
{
char *lpBuffer = (char*) hb_xgrab( MAX_PATH+1);
LPITEMIDLIST pidlBrowse; // PIDL selected by user
SHGetSpecialFolderLocation(GetActiveWindow(), hb_parni(1), &pidlBrowse)
;
SHGetPathFromIDList(pidlBrowse, lpBuffer);
hb_retc(lpBuffer);
hb_xfree( lpBuffer);
}
// eop link executor *******************
#pragma ENDDUMP-------------------------------------------------------
Prg file : XXX.prg
*-------------------------------------------------------
Procedure CreateLink( lDesk, lMenu )
*--------------------------------------------------------*
local cDesktop := GetSpecialFolder( CSIDL_DESKTOPDIRECTORY )
local cMenuPrgs := GetSpecialFolder( CSIDL_PROGRAMS )
local cLinkName := "proves"
local cExeName := ExeName()
Local cFilePath
local cIco := ""
If CurDrive() = "@"
cFilePath:= NetRmtName( CurDrive()+":" )+"\"+CURDIR()
Else
cFilePath:= CurDrive()+":\"+CURDIR()
EndIf
cIco := cExeName
if lDesk && desktop
if CreateFileLink( cDesktop + "\" + cLinkName, cExeName,cFilePath,cIco ) # 0
Duda( "Create Link Error!", "Acceptar")
endif
endif
if lMenu && menu start
if CreateFileLink( cMenuPrgs + "\" + cLinkName, cExeName,cFilePath,cIco ) # 0
Duda( "Create Link Error!", "Acceptar")
endif
endif
Return
I hope that you have helped.
Pere