cha0ticz
asked on
Modify the working directory of a .lnk file (shortcut file)
I need to change the working directory for a massive amount of *.lnk files in sub directories from a root directory. Everything I've found concerning *.lnk files has been on how to create them using iShellLink and I can't seem to figure out how to simply open an existing shortcut, change its working directory (I know its SetWorkingDirectory, but just initializing the shortcut as a object is the problem I'm having), then saving the changes.
Any help will be greatly appreciated.
Any help will be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the HRESULT value that is returned?
ASKER
I see a return value of -2147221008 for it. No clue what that is, but it doesn't match S_OK, REGDB_E_CLASSNOTREG, or CLASS_E_NOAGGREGATION . Maybe I'm wrong on that though...
>>-2147221008
...aka 0x800401F0
//
// MessageId: CO_E_NOTINITIALIZED
//
// MessageText:
//
// CoInitialize has not been called.
//
#define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401 F0L)
I suspect you have not called 'CoInitialize()' :o)
...aka 0x800401F0
//
// MessageId: CO_E_NOTINITIALIZED
//
// MessageText:
//
// CoInitialize has not been called.
//
#define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401
I suspect you have not called 'CoInitialize()' :o)
ASKER
Doh, duh. Thanks for your help!
ASKER
Thank you for the code, however I'm getting a fail with
hres = CoCreateInstance(CLSID_She
I have objbase and shlobj included as well as ole32.lib and shell32.lib linked so I have no clue why that is failing.