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:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: GetWindowPlacement api
Maybe if it reports it as open, try to check for the dimensions of the window using the (GetWindowPos?) API?
<Eljay> "Problems encountered: shit blew up" :zippy:
12-20-2006 05:43 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
Maybe if it reports it as open, try to check for the dimensions of the window using the (GetWindowPos?) API?


Thank Spunky i'll try to do it and i will report if it work or not...
:(:(:( Don't work...i have also tried "IsVisibleWindow" api function but seems that even if the chatwnd is invisible when i minized it,it results visible...mmmhh i don't know why...


tomorrow i'll reverse msn to discover it
12-20-2006 05:47 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
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');
    }
}

No...

SW_MINIMIZE (0x6) is not the same as SW_SHOWMINIMIZED (0x2).

If you read the MSDN documentation on the GetWindowPlacement API it states:
quote:
If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.
So the only values you need to check for are:
SW_SHOWNORMAL (0x1)
SW_SHOWMINIMIZED (0x2)
SW_SHOWMAXIMIZED (0x3)

There will be no other value returned by the function in the WINDOWPLACEMENT structure.

Speaking of which, the MSDN docs also states:
quote:
The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE.
but nevertheless the API will function though. (dodgy MS keeping stuff like this for compatibily reasons, instead of urging programmers to do the right thing in the first place).

---------------------------------

As for detecting if a chat window is minimized or not. That is far from straightforward when grouped chats are used. This because then Messenger Plus! controls what window is minimized, maximized or normal because the chat windows will become owned by a hidden Plus! window.

To see if grouped chats are in use, you must check if an owner window exist.
If so, you can not check with the GetWindowPlacement API like you normally would for the state of a chatwindow since Plus! will always disable automatically the chats which aren't visible and not minimize them (hence why you'll see 'normal' with the GetWindowPlacement API on those chats).

So if you see that a chat is 'normal' and you see that grouped chats is in use, you must use the IsWindowEnabled API in those cases to see if the chat window is disabled (aka minimized) or not.

But even then it isn't that straightforward. Only when _all_ chat windows are disabled, you could assume that the grouped chat as a whole has been truely minimized. In other cases it is quite possible that the chat window you're checking on will give you 'disabled', eventhough other windows are enabled and thus nothing is minimized at all.


TheGuruSupremacy, a solution for this extremely depends on what you want to do _exactly_. "I want to check if a chat is minimized" is way to vague to give you a proper solution. It totally depends on _why_ you want to know that and what you're going to do with it. Since there is a difference, in case of grouped chatting, between the real state and the thing you see on your screen.

This post was edited on 07-19-2008 at 08:22 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-20-2006 07:36 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: RE: RE: GetWindowPlacement api
quote:
Originally posted by CookieRevised
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');
    }
}

No...

SW_MINIMIZE (0x6) is not the same as SW_SHOWMINIMIZED (0x2).

If you read the MSDN documentation on the GetWindowPlacement API it states:
quote:
If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.
So the only values you need to check for are:
SW_SHOWNORMAL (0x1)
SW_SHOWMINIMIZED (0x2)
SW_SHOWMAXIMIZED (0x3)

There will be no other value returned by the function in the WINDOWPLACEMENT structure.

Speaking of which, the MSDN docs also states:
quote:
The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE.
but nevertheless the API will function though. (dodgy MS keeping stuff like this for compatibily reasons, instead of urging programmers to do the right thing in the first place).

---------------------------------

As for detecting if a chat window is minimized or not. That is far from strait forward when grouped chats are used. This because then Messenger Plus! controls what window is minimized, maximized or normal because the chat windows will become owned by a hidden Plus! window.

To see if grouped chats are in use, you must check if an owner window exist.
If so, you can not check with the GetWindowPlacement API like you normally would for the state of a chatwindow since Plus! will always disable automatically the chats which aren't visible and not minimize them (hence why you'll see 'normal' with the GetWindowPlacement API on those chats).

So if you see that a chat is 'normal' and you see that grouped chats is in use, you must use the IsWindowEnabled API in those cases to see if the chat window is disabled (aka minimized) or not.

But even then it isn't that strait forward. Only when _all_ chat windows are disabled, you could assume that the grouped chat as a whole has been truely minimized. In other cases it is quite possible that the chat window you're checking on will give you 'disabled', eventhough other windows are enabled and thus nothing is minimized at all.


TheGuruSupremacy, a solution for this extremely depends on what you want to do _exactly_. "I want to check if a chat is minimized" is way to vague to give you a proper solution. It totally depends on _why_ you want to know that and what you're going to do with it. Since there is a difference, in case of grouped chatting, between the real state and the thing you see on your screen.

Right Cookie,but can you help me???.....Nothing about my question??

This post was edited on 12-20-2006 at 09:22 PM by TheGuruSupremacy.
12-20-2006 09:21 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: GetWindowPlacement api
Not without answering:
quote:
Originally posted by CookieRevised
TheGuruSupremacy, a solution for this extremely depends on what you want to do _exactly_. "I want to check if a chat is minimized" is way to vague to give you a proper solution. It totally depends on _why_ you want to know that and what you're going to do with it. Since there is a difference, in case of grouped chatting, between the real state and the thing you see on your screen.

If you want to check on the (simulated in group chatting!) state you'll see on the screen, thus where minimized doesn't necessarily means the actual window is minimized, you could use the attached function.

But again, use that with extreme caution as the usefullness and correctness of it depends on what you exactly want to achieve with getting the window states.

.zip File Attachment: TEST - GetWindowPlacement.zip (1.35 KB)
This file has been downloaded 99 time(s).

This post was edited on 12-20-2006 at 10:44 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-20-2006 09:49 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 CookieRevised
Not without answering:
quote:
Originally posted by CookieRevised
TheGuruSupremacy, a solution for this extremely depends on what you want to do _exactly_. "I want to check if a chat is minimized" is way to vague to give you a proper solution. It totally depends on _why_ you want to know that and what you're going to do with it. Since there is a difference, in case of grouped chatting, between the real state and the thing you see on your screen.

If you want to check on the (simulated in group chatting!) state you'll see on the screen, thus where minimized doesn't necessarily means the actual window is minimized, you could use the attached function.

But again, use that with extreme caution as the usefullness and correctness of it depends on what you exactly want to achieve with getting the window states.


OK....sorry i didn't see the answering in your previuos post................ ....HOWEVER THANK A LOT COOKIE....YOU ARE ALWAYS HELPFUL:):)......I haven't tried the code yet,but i have seen it and i think that it  should work!......THANK AGAIN COOKIE:)


edit:I have tried it and it works PERFECTLY...when i have at least 100 posts
i'll vote for you:)

This post was edited on 12-21-2006 at 10:55 AM by TheGuruSupremacy.
12-21-2006 10:27 AM
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