COM - works in main thread, but not in seperate thread?
Posted on 2005-04-28
Please look at the code below. I would like to know why it behaves differently in when I call it from a seperate thread. Is there some sort of special COM/OLE initialization that I must do to make it work in a seperate thread?
ShellApi,ShlObj, ComObj, ActiveX;
Path: array[0..MAX_PATH] of Char;
psl : IShellLink;
SHGetSpecialFolderLocation(Application.Handle, CSIDL_RECENT, PIDL);
if psl.QueryInterface(IPersistFile, ppf) = 0 then
//Program gets here if main thread calls DoSomething.
//Program does not get here if a seperate thread calls DoSomething.