What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » GetWindowPlacement api

Pages: (2): « First [ 1 ] 2 » Last »
GetWindowPlacement api
Author: Message:
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. GetWindowPlacement api
i have a problem when i try to retrive when a chatwindow is minimized
I use matty's function(GetWindowPlacement api):

var WindowPlacment = Interop.Allocate(48);
function _getPlacement(hWnd){
    if (hWnd > 0){
        Interop.Call('user32', 'GetWindowPlacement', hWnd, WindowPlacement);
       
        Debug.Trace('> .showCmd : '+WindowPlacement.ReadDWORD(8));
        if (WindowPlacement.ReadDWORD(8) == 3){
            Debug.Trace(' > .showCmd : Maximized');
        } else if (WindowPlacement.ReadDWORD(8) == 2){
            Debug.Trace(' > .showCmd : Minimized');
        } else if (WindowPlacement.ReadDWORD(8) == 1){
            Debug.Trace(' > .showCmd : Opened');
        }
    } else {
        Debug.Trace(' > .showCmd : Closed');
    }
}


but with it i can retrive when it opened ,maximized ,closed but i can't retrive when is minimized...Can someone help me???Thanks in advice
12-20-2006 04:32 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: GetWindowPlacement api
According to the MSDN site and the Win32 API Constants, this should do it:
code:
var WindowPlacment = Interop.Allocate(48);
function _getPlacement(hWnd){
    if (hWnd > 0){
        Interop.Call('user32', 'GetWindowPlacement', hWnd, WindowPlacement);
       
        Debug.Trace('> .showCmd : '+WindowPlacement.ReadDWORD(8));
        if (WindowPlacement.ReadDWORD(8) == 3){
            Debug.Trace(' > .showCmd : Maximized');
        } else if (WindowPlacement.ReadDWORD(8) == 2){
            Debug.Trace(' > .showCmd : Minimized');
        } else if (WindowPlacement.ReadDWORD(8) == 1){
            Debug.Trace(' > .showCmd : Opened');
        } else if(WindowPlacement.ReadDWORD(8) == 6){
            Debug.Trace(' > .showCmd : Opened');
        }

    } else {
        Debug.Trace(' > .showCmd : Closed');
    }
}

This post was edited on 12-20-2006 at 04:42 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-20-2006 04:40 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: GetWindowPlacement api
Why not use:

if(<maximised>){
...
...
}else if(<opened>){
...
...
}else{
//Must be minimised
...
}
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 04:44 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: RE: GetWindowPlacement api
quote:
Originally posted by Mattike
According to the MSDN site and the Win32 API Constants, this should do it:
code:
var WindowPlacment = Interop.Allocate(48);
function _getPlacement(hWnd){
    if (hWnd > 0){
        Interop.Call('user32', 'GetWindowPlacement', hWnd, WindowPlacement);
       
        Debug.Trace('> .showCmd : '+WindowPlacement.ReadDWORD(8));
        if (WindowPlacement.ReadDWORD(8) == 3){
            Debug.Trace(' > .showCmd : Maximized');
        } else if (WindowPlacement.ReadDWORD(8) == 2){
            Debug.Trace(' > .showCmd : Minimized');
        } else if (WindowPlacement.ReadDWORD(8) == 1){
            Debug.Trace(' > .showCmd : Opened');
        } else if(WindowPlacement.ReadDWORD(8) == 6){
            Debug.Trace(' > .showCmd : Opened');
        }

    } else {
        Debug.Trace(' > .showCmd : Closed');
    }
}


Don't work so...However the problem is not this...I can't retrive when it's minimized not when it's opened..to retrive if it's opened i can use findwindow api function

This post was edited on 12-20-2006 at 04:50 PM by TheGuruSupremacy.
12-20-2006 04:49 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: GetWindowPlacement api
* Spunky repeats himself :p
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 04:50 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: RE: GetWindowPlacement api
quote:
Originally posted by SpunkyLoveMuff
Why not use:

if(<maximised>){
...
...
}else if(<opened>){
...
...
}else{
//Must be minimised
...
}


your code can't work because the value is always 3 or 1 also when it's minimized so else operator can't work because there isn't another value....The problem is that matty's code always works except for chatwindow

This post was edited on 12-20-2006 at 04:56 PM by TheGuruSupremacy.
12-20-2006 04:53 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: GetWindowPlacement api
If it always returns 3 or 1, then thats got to be what Windows is reporting it as.

I got this in my debug window when testing:
code:
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 1
> .showCmd : Opened
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 3
> .showCmd : Maximized
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 2
> .showCmd : Minimized

The function works fine (except the var in the above codes you have posted is called WindowPlacment not WindowPlacement)

EDIT: This also mean the if statement I suggested would work (except for if it encountered an error and returned 0)

This post was edited on 12-20-2006 at 05:05 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 05:03 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: RE: GetWindowPlacement api
quote:
Originally posted by SpunkyLoveMuff
If it always returns 3 or 1, then thats got to be what Windows is reporting it as.

I got this in my debug window when testing:
code:
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 1
> .showCmd : Opened
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 3
> .showCmd : Maximized
Script has been stopped
Script is starting
Script is now loaded and ready
> .showCmd : 2
> .showCmd : Minimized

The function works fine (except the var in the above codes you have posted is called WindowPlacment not WindowPlacement)

EDIT: This also mean the if statement I suggested would work (except for if it encountered an error and returned 0)

debug log:
Funzione chiamata: OnEvent_Timer
4654408
2557932
> .showCmd : 1
> .showCmd : Opened
False
Funzione chiamata: OnEvent_Timer
4654408
2557932
> .showCmd : 3
> .showCmd : Maximized
False
Funzione chiamata: OnEvent_Timer
4654408
2557932
> .showCmd : 1
> .showCmd : Opened     //THE WINDOW WAS MINIMIZED
False

however yes i know about the var...DO YOU TESTING THE CODE ON A CHATWND OR ON ANOTHER WINDOW??...BECAUSE I HAVE ALSO TESTED  ON ANOTHER WINDOW AND IT  WORKED...tHE CODE DON'T WORK ONLY ON CHATWND

This post was edited on 12-20-2006 at 05:20 PM by TheGuruSupremacy.
12-20-2006 05:17 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: GetWindowPlacement api
It's a tabs issue :p It works fine when tabs are disabled, but not when they are in use. I think it's the way Plus! hides the windows rather than minimizing and so on
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 05:29 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: RE: GetWindowPlacement api
quote:
Originally posted by SpunkyLoveMuff
It's a tabs issue :p It works fine when tabs are disabled, but not when they are in use. I think it's the way Plus! hides the windows rather than minimizing and so on


yes i also tought it....but there is any way to detect if it's minimized??
because i need to have tabs
12-20-2006 05:36 PM
Profile PM 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