About Desktop Play!

Started by
24 comments, last by Eddycharly 15 years, 5 months ago
Hi David,
Acording to Spy++, the window FunDesktop draws on is "Internet Explorer_Server" (this window exists only when active desktop is enabled).
The "SysListView32" window is the one drawing the icons.

You can hide the icons if you want, just :
ShowWindow (GetWindow (GetWindow (FindWindow ("ProgMan", NULL), GW_CHILD), GW_CHILD), SW_HIDE);
Advertisement
About hooking, i didn't use it in the same way as you.
I used hooking only to inject my dll in the target process.

my hook proc was like this :

LRESULT CALLBACK HookProc (int nCode, WPARAM wParam, LPARAM lParam)
{
while (HookHandle == 0)
{
Sleep (50);
}

// if nCode < 0, we MUST chain the message
if (nCode < 0) return CallNextHookEx (HookHandle, nCode, wParam, lParam);

// Here we could break the hook chain if we wanted
return CallNextHookEx (HookHandle, nCode, wParam, lParam);
}

As you can see, it does nothing but calls the next hook in the chain (HookHandle is the previous handle returned by SetWindowsHookEx).


Subclassing the desktop window, initializing direct x, etc was NOT done in the hook proc but in the DllMain function.
As for every dll, when the dll is loaded/unloaded in the target process, the DllMain function is called by the system and you can use that to make what you want.
Hi Eddycharly,

Thanks for your help! It works well now.
Hi Eddycharly,

I found a new problem. My programme need switch between Desktop mode and windowed mode, but i can switch to the Desktop mode for only once, just the first time. Any other swtiches to desktop mode fail. For example, my AP initials with windowed mode, then i switch it to the desktop mode(this is the first time i switch it to the desktop mode) and it succeeds. Next i switch it to the windowed mode(it is ok too) and now i want to switch it back to the desktop mode, but fail(there was no video on the active desktop and i found the active desktop's handle is changed). Had you met this problem before?


Thanks!
Hi,

To find the right handle of the active desktop, i need to sleep some time before calling FindWindow function. Any good idea? Thanks!
Hi David,

I made a quick test with Spy++, and yes, the window handle can change.
Enable AD, launch Spy++, then display the desktop and hit F5 to refresh the window.
Each time you hit F5, Spy++ will show the AD window handle has changed.

I guess that when explorer.exe recives a refresh command, it just destroys and recreates the AD window...

It's probably possible to subclass another window in the process to trap refresh commands, but then the behaviour of the desktop could be impacted.

I think your application should take the possiblity that the window changed into account. That's how i designed FunDesktop.

This topic is closed to new replies.

Advertisement