Answer the question
In order to leave comments, you need to log in
How to add a shortcut launch parameter through the program?
Hello!
Let's say there is a shortcut (*.lnk):
[object: "C:\Games\Counter-Strike\hl.exe"]
Run the program, find this file (*.lnk) and change:
[object: "C:\Games \Counter-Strike\hl.exe" - game cstike ]
In general, tell me the code in C ++.
Answer the question
In order to leave comments, you need to log in
Something like this on bare COM:
IPersistFile *ipf;
IShellLinkA *isl;
HRESULT rc;
rc=CoInitialize(NULL);
rc=CoCreateInstance(CLSID_ShellLink,0,CLSCTX_INPROC_SERVER,IID_IPersistFile,(void**)&ipf);
rc=ipf->Load(L"something.lnk",0);
rc=ipf->QueryInterface(IID_IShellLinkA,(void**)&isl);
rc=isl->SetArguments("- game cstike");
rc=ipf->Save(L"something.lnk",1);
ipf->Release();
isl->Release();
CoUninitialize();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question