hide windows and child windows

delphi package - easy access to kernel objects etc.
Post Reply
unknown
Posts: 3
Joined: Sat Jun 11, 2005 1:24 pm

hide windows and child windows

Post by unknown »

Hello, i'm trying to implement in delphi a feature that'0s in the msn plus called boss protection. When pressed some predefined keys, the MSN window and all conversation windows are hidden and if a new windows appears from msn messenger that windows is hidden too until the boss protection is deactivated.

Using madkernel i hide the windows doing this:

Process('msnmsgr.exe').Windows_.Hide;

But then if a new message arrives from another user that new window is visible.

The question is: Is there a way to avoid new windows from being visible without looping in order to detect if the process has new windows and hide them? (to avoid too much cpu consuming).

In case its not possible here's another question., I used a multimedia timer like this:

procedure TimeCallBack(TimerID, Msg: Uint; dwUser, dw1, dw2: DWORD); pascal;
begin
ip.TaskbarWindows.Hide;
end;

where ip was declared like this:

ip : Iprocess;

and initialized like this:

ip := Process('msnmsgr.exe');

The thing is that if i stop the timer and then call:

ip.TaskbarWindows.show;

or:

Process('msnmsgr.exe').TaskBarWindows.show;

the conversation windows are not displayed again.

Any ideas why? and.. can i stop the little toasts (the little boxes on the down left corner that let you know when someone comes online) from showing too??

thanks in advance,
unknown.
unknown
Posts: 3
Joined: Sat Jun 11, 2005 1:24 pm

Post by unknown »

Ok i figured out why Process('msnmsgr').TaskbarWindows.show; doesn't show the conversation windows, it's because after they're hidden they don't belong to the taskbar anymore so they're not in that list.

I'd still like to know if it's possible to avoid conversation windows from showing if parent window (msn main window) is hidden without having to loop through the list of taskbar windows and hiding them (like i said, timers comsume too much cpu).

Thanks in advance,
unknown.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can use SetWindowsHookEx(WH_CBT) or WH_SHELL (I believe) to get notification about newly created windows.
unknown
Posts: 3
Joined: Sat Jun 11, 2005 1:24 pm

Post by unknown »

Hello Madshi thanks for your help, just one question though, if i hook HCBT_ACTIVATE and I return 1 in order to avoid the operation then the window won't be created and so i won't be able to show it later right?
what should i do, allow the operation and hide the window (the hook gives me the handle)? or whould i hook HCBT_CREATEWND, get the handle and hide it? the thing is that i don't want the window to show not even just a sec?

what would you recommend?

thanks in advance, uinknown.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Don't know, I'm not SetWindowsHookEx expert. Just try what works best for you.
Post Reply