I have WinNT 4.0 SP6 with IE 4.0 SP2 installed. Desktop Update was
also installed with IE.
I am trying to access Active Desktop settings from the service via
IActiveDesktop interface. User profile is correctly loaded, so that
registry hive HKEY_CURRENT_USER is valid. Also I call SetThreadDesktop() to
attach my service thread to the current desktop.
However, disregarding the current desktop setting (“View as Web
Page”) IActiveDesktop::GetDesktopItemOptions() method always returns
the same information.
This is the code excerpt, which I use to retrieve the settings:
//
// NB! It may not compile since I stripped it
//
IActiveDesktop *pActiveDesktop = NULL;
HRESULT hr = ::CoInitialize(NULL);
if( SUCCEEDED(hr) )
{
hr = ::CoCreateInstance(CLSID_ActiveDesktop, NULL,
CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (void**)&pActiveDesktop);
if( SUCCEEDED(hr) )
{
WCHAR wszFilename[_MAX_PATH] = L"";
pActiveDesktop->GetPattern(wszFilename, sizeof(wszFilename), 0);
pActiveDesktop->GetWallpaper(wszFilename, sizeof(wszFilename), 0);
WallpaperOpt.dwSize = sizeof(WallpaperOpt);
pActiveDesktop->GetWallpaperOptions(&WallpaperOpt, 0);
ComponentsOpt.dwSize = sizeof(ComponentsOpt);
pActiveDesktop->GetDesktopItemOptions(&ComponentsOpt, 0);
//
// Here I always have:
//
// ComponentsOpt.fActiveDesktop == TRUE
// ComponentsOpt.fEnableComponents == TRUE
//
pActiveDesktop->Release();
}
::CoUninitialize();
}
This code works in the service correctly on Win98/ME/2K/XP. Only fails
on WinNT 4.0.
I also tried this code snippet in a test application - it ALWAYS works
correcly.
Please, if anyone can explain why this code fails in the service. Or
maybe there is another reason?
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com