What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Finding a window and stopping it from displaying

Pages: (2): « First [ 1 ] 2 » Last »
Finding a window and stopping it from displaying
Author: Message:
ryxdp
Senior Member
****


Posts: 804
Reputation: 16
29 / Male / Flag
Joined: Jun 2006
O.P. Finding a window and stopping it from displaying
How would I go about regularly checking whether this window exists:

WMP9MediaBarFlyout1342137C

and then stop it from becoming visible using some means (I guess DestroyWindow would be sufficient here)? I'd imagine FindWindowEx would be needed, but I don't know where to start; I need to find a practical way of regularly checking on the window, as in, when it happens, not every five seconds or so.

Thanks in advance :P
06-13-2009 07:39 AM
Profile PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Finding a window and stopping it from displaying
Dunno if one can actually "block" windows, but you can indeed find it and close it:

JScript code:
function FindWindow(hWndParent,lpszClass,lpszWindow) {
    if(typeof hWndParent !== "number") hWndParent = 0;
    if(typeof lpszClass !== "string") lpszClass = 0; // NULL
    if(typeof lpszWindow !== "string") lpszWindow = 0; // NULL
    var hWndReturn = 0;
    do {
        hWndReturn = Interop.Call("User32.dll","FindWindowExW",hWndParent,hWndReturn,lpszClass,lpszWindpw);
    } while(hWndReturn !== 0)
    return hWndReturn;
}

function CloseWindow() {
    Interop.Call("User32.dll",
    "DestroyWindow",
    FindWindow(0 /* do you have a parent window? */,
        "WMP9MediaBarFlyout1342137C" /* I think it's the class name you're talking about? */));
}

Should work this way. Note that if "WMP9MediaBarFlyout1342137C" the window title (and not the class name), you need to send 0, 0 and WMP9MediaBarFlyout1342137C respectively.

This post was edited on 06-13-2009 at 02:32 PM by SmokingCookie.
06-13-2009 02:31 PM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: Finding a window and stopping it from displaying
If you write a DLL (then load it from plus), you can use it to install a CBT hook which will allow you to filter windows as they are created.

See SetWindowsHookEx and HCBT_CREATEWND in CBTProc
06-15-2009 05:02 AM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Finding a window and stopping it from displaying
Is that actually possible? Cuz I think the pointer to CBTProc is asynchronous.
06-15-2009 06:23 AM
Profile PM Find Quote Report
ryxdp
Senior Member
****


Posts: 804
Reputation: 16
29 / Male / Flag
Joined: Jun 2006
O.P. RE: Finding a window and stopping it from displaying
I guess I should explain a bit more. All I want is a simple way to check whether this popup window exists:

[Image: attachment.php?pid=965655]

and get rid of it by some means, most likely DestroyWindow. It looks like the parent window is indeed the desktop, and it is the class name, so the script should work, but it doesn't seem to be able to find the window, just keeps giving me 0.

The reason why I want to get rid of it is because when I change tracks in WMP, it pops up.

I hope they get rid of that in WMP11

.png File Attachment: wmpflyout.png (7.58 KB)
This file has been downloaded 455 time(s).

This post was edited on 06-15-2009 at 07:18 AM by ryxdp.
06-15-2009 07:15 AM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: RE: Finding a window and stopping it from displaying
quote:
Originally posted by SmokingCookie
Is that actually possible? Cuz I think the pointer to CBTProc is asynchronous.
As long as the DLL stays loaded, it shouldn't be a problem.  (the CBTProc would need to be in the DLL, and you may as well install the hook from inside the DLL as well.)

quote:
Originally posted by ryxdp
but it doesn't seem to be able to find the window, just keeps giving me 0.
Are you sure the class name is "WMP9MediaBarFlyout1342137C" and not just "WMP9MediaBarFlyout"?  If the window exists and you've got the class name correct, it *should* be found.  How are you determining the class name?  Spy++?

This post was edited on 06-15-2009 at 01:39 PM by TheSteve.
06-15-2009 01:37 PM
Profile PM Web Find Quote Report
ryxdp
Senior Member
****


Posts: 804
Reputation: 16
29 / Male / Flag
Joined: Jun 2006
O.P. RE: RE: RE: Finding a window and stopping it from displaying
quote:
Originally posted by TheSteve
Are you sure the class name is "WMP9MediaBarFlyout1342137C" and not just "WMP9MediaBarFlyout"?  If the window exists and you've got the class name correct, it *should* be found.  How are you determining the class name?  Spy++?

I'm using Winspector:

[Image: attachment.php?pid=965779]

.png File Attachment: wmpflyout.png (5.51 KB)
This file has been downloaded 447 time(s).
06-16-2009 07:41 AM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: Finding a window and stopping it from displaying
Try tracing out the parameters right before the call to FindWindowExW.  Make sure that they are being passed correctly. (not getting messed up by the "typeof var")
06-17-2009 03:00 PM
Profile PM Web Find Quote Report
ryxdp
Senior Member
****


Posts: 804
Reputation: 16
29 / Male / Flag
Joined: Jun 2006
O.P. RE: Finding a window and stopping it from displaying
Well, it looks like the DestroyWindow function is failing, which suggests (to me) that WMP is somehow preventing it from being destroyed...

This post was edited on 06-18-2009 at 10:18 AM by ryxdp.
06-18-2009 10:17 AM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Finding a window and stopping it from displaying
You can't DestroyWindow() another program's window:

quote:
MSDN - DestroyWindow() Function
A thread cannot use DestroyWindow to destroy a window created by a different thread.


Please nicely send WM_CLOSE message to that window and let it decide whether to close or not :p

This post was edited on 06-18-2009 at 06:34 PM by Mnjul.
06-18-2009 06:33 PM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On