J'ai cherché dans le forum, pour metre un raccourcis sur le bureau, et j'ai découvert le code suiventJ'ai adapté le code a ma fenetre, mais pb, il n'accepte pas ma chaine de caractère pour la localisation du raccourcis
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 HRESULT hres; IShellLink* psl; WORD wsz[MAX_PATH]; CoInitialize(NULL); hres = CoCreateInstance(CLSID_ShellLink, NULL,CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl); if (SUCCEEDED(hres)) { IPersistFile* ppf; psl->SetPath("C:\\Windows\\calc.exe"); psl->SetDescription("Calculatrice"); psl->QueryInterface(IID_IPersistFile,(LPVOID *)&ppf); MultiByteToWideChar(CP_ACP, 0,"C:\\Windows\\Bureau\\Calc.lnk", -1, (LPWSTR)wsz, MAX_PATH); ppf->Save((LPWSTR)wsz, TRUE); ppf->Release(); } psl->Release(); CoUninitialize();
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 HRESULT hres; IShellLink* psl; WORD wsz[MAX_PATH]; CoInitialize(NULL); hres = CoCreateInstance(CLSID_ShellLink, NULL,CLSCTX_INPROC_SERVER,IID_IShellLink, (LPVOID *)&psl); if (SUCCEEDED(hres)) { IPersistFile* ppf; psl->SetPath(step3->Edit1->Text + "PackCIS.exe"); psl->SetDescription("PackCIS"); psl->QueryInterface(IID_IPersistFile,(LPVOID *)&ppf); MultiByteToWideChar(CP_ACP, 0,step3->CheminSpecialFolder(CSIDL_STARTMENU) + "\\Cav\\PackCIS\\PackCIS.lnk", -1, (LPWSTR)wsz, MAX_PATH); ppf->Save((LPWSTR)wsz, TRUE); ppf->Release(); } psl->Release(); CoUninitialize();
Partager