| GetWindowPlacement api | 
| Author: | Message: | 
| TheGuruSupremacy Full Member
 
    
 
  
 Posts: 367
 Reputation: 19
 35 /
  /  Joined: Nov 2006
 
 | | O.P.  GetWindowPlacement api i have a problem when i try to retrive when a chatwindow is minimizedI 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 |  | 
|  | 
| Matti Elite Member
 
      
 
  Script Developer and Helper
 
 Posts: 1646
 Reputation: 39
 33 /
  /  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.
 | 
 | 
| 12-20-2006 04:40 PM |  | 
|  | 
| Spunky Former Super Mod
 
      
 
  
 Posts: 3656
 Reputation: 61
 37 /
  /  Joined: Aug 2006
 
 | | RE: GetWindowPlacement api Why not use:
 if(<maximised>){
 ...
 ...
 }else if(<opened>){
 ...
 ...
 }else{
 //Must be minimised
 ...
 }
 <Eljay> "Problems encountered: shit blew up"   | 
 | 
| 12-20-2006 04:44 PM |  | 
|  | 
| TheGuruSupremacy Full Member
 
    
 
  
 Posts: 367
 Reputation: 19
 35 /
  /  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 functionThis post was edited on 12-20-2006 at 04:50 PM by TheGuruSupremacy.
 | 
 | 
| 12-20-2006 04:49 PM |  | 
|  | 
| Spunky Former Super Mod
 
      
 
  
 Posts: 3656
 Reputation: 61
 37 /
  /  Joined: Aug 2006
 
 | | RE: GetWindowPlacement api * Spunky repeats himself  <Eljay> "Problems encountered: shit blew up"   | 
 | 
| 12-20-2006 04:50 PM |  | 
|  | 
| TheGuruSupremacy Full Member
 
    
 
  
 Posts: 367
 Reputation: 19
 35 /
  /  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 chatwindowThis post was edited on 12-20-2006 at 04:56 PM by TheGuruSupremacy.
 | 
 | 
| 12-20-2006 04:53 PM |  | 
|  | 
| Spunky Former Super Mod
 
      
 
  
 Posts: 3656
 Reputation: 61
 37 /
  /  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 WindowPlace ment)
 
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"   | 
 | 
| 12-20-2006 05:03 PM |  | 
|  | 
| TheGuruSupremacy Full Member
 
    
 
  
 Posts: 367
 Reputation: 19
 35 /
  /  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 CHATWNDThis post was edited on 12-20-2006 at 05:20 PM by TheGuruSupremacy.
 | 
 | 
| 12-20-2006 05:17 PM |  | 
|  | 
| Spunky Former Super Mod
 
      
 
  
 Posts: 3656
 Reputation: 61
 37 /
  /  Joined: Aug 2006
 
 | | RE: GetWindowPlacement api It's a tabs issue    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"   | 
 | 
| 12-20-2006 05:29 PM |  | 
|  | 
| TheGuruSupremacy Full Member
 
    
 
  
 Posts: 367
 Reputation: 19
 35 /
  /  Joined: Nov 2006
 
 | | O.P.  RE: RE: GetWindowPlacement api quote:Originally posted by SpunkyLoveMuff
 It's a tabs issue
  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 |  | 
|  | 
| Pages: (2): 
« First
  
 [ 1 ]
 2
 
»
 
Last » | 
|  |