I need to use the (undocumented) ITrayNotify interface.
It's working fine when run as a normal/UAC-restricted process in Windows 7.
However, when I run it elevated ("Run as Administrator") the CoCreateInstance call returns -2147221164 = $80040154 = REGDB_E_CLASSNOTREG = "Class not registered".
I've tested it on 4 different Windows 7 systems with the same result. It's the same for x64 and x86.
How is this possible? Is this interface blocked for elevated processes? Is there a workaround for that?
For what it matters, heres the relevant part of the code. It's in Delphi, but I don't think that's relevant, since it works fine non-elevated.
classGuid := StringToGUID('{25DEAD04-1EAC-4911-9E3A-AD0A4AB560FD}');
interfaceGuid := StringToGUID('{FB852B2C-6BAD-4605-9551-F15F87830935}');
result := CoCreateInstance(classGuid, nil, CLSCTX_LOCAL_SERVER, interfaceGuid, trayNotify);
Edit/Notice: The problem isn't present in Windows 10 or 8. The interface is slightly different there and it works fine both elevated and non-elevated. The problem only applies to Windows 7 (don't know about Vista, not relevant for XP).