AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Restore WLM chatwindow from minimized state

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
HuBa



Joined: 24 Feb 2007
Posts: 172
Location: Budapest, Hungary

PostPosted: Mon Mar 17, 2008 10:42 pm    Post subject: [SOLVED] Restore WLM chatwindow from minimized state Reply with quote

It should be an easy job on every window, but Windows Live Messenger's chatwindow is not an "average" window.

Minimizing works fine, but it seems it is immune to the WinRestore command while minimized.

Code:
#IfWinExist ahk_class IMWindowClass

^+B::
WinGet ch_Minimized, MinMax, ahk_class IMWindowClass
if ch_Minimized = -1
{
  PostMessage 0x112, 0xF120,,, ahk_class IMWindowClass  ; 0x112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
  ;WinRestore ahk_class IMWindowClass
}
else
{
  PostMessage 0x112, 0xF020,,, ahk_class IMWindowClass  ; 0x112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
  ;WinMinimize ahk_class IMWindowClass
}
Return

#IfWinExist


First thing is what I noticed, that the value of ch_Minimized is always 0, never -1.
Check it with MsgBox %ch_Minimized%

Now how can I restore this window if it is minimized?


Last edited by HuBa on Tue Mar 18, 2008 6:47 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
System Monitor



Joined: 09 Mar 2007
Posts: 401
Location: Unknown

PostPosted: Mon Mar 17, 2008 10:51 pm    Post subject: Reply with quote

Maybe Winset, Top then Winactivate Confused
_________________
Back to top
View user's profile Send private message Visit poster's website
HuBa



Joined: 24 Feb 2007
Posts: 172
Location: Budapest, Hungary

PostPosted: Tue Mar 18, 2008 6:47 pm    Post subject: Reply with quote

WinSet, Top doesn't do anything, but WinActivate do the trick. Thank you!

Now the final remaining problem is to detect the state of the window to allow toggling. Unfortunately WinGet MinMax always returns 0.

But I think it is not important anyway, since checking for IfWinActive is better.

Now here is the solution:
Code:
#IfWinExist ahk_class IMWindowClass

^+B::
IfWinActive ahk_class IMWindowClass
  PostMessage 0x112, 0xF020  ; 0x112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
else
  WinActivate ahk_class IMWindowClass
Return

#IfWinExist
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group