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 

How to change GUI Window name when it minimizes

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



Joined: 28 Apr 2004
Posts: 45

PostPosted: Thu Jun 12, 2008 7:27 pm    Post subject: How to change GUI Window name when it minimizes Reply with quote

Hi all. I've written a program and I have one last little thing I want to do with it before showcasing it here. I played with a ton of the encryption threads here in the forums and came up with a (IMHO) slick little encryptor program mostly for chats (got a lot of gossip hounds in my work).

It is a GUI. When using it, the title I have it set to is something like "Secret Chat in MyFriend -- Instant Message" so I know that THIS instance of the program ties to THAT window.

For a "Boss Key", when the program minimizes (like when someone walks by) I want it to change back to the default title "Secret Chat" and wipe out all the codes/passphrases, etc. I have everything working correctly (clearing all the variables) EXCEPT making it clear the title.

I think it would be with some kind of GUI Submit or GUI Destroy, but I either can't get it to reset the title or I can't get it to restart minimized (I don't want it to flash up full then minimize either).

Here's what I've written for it so far:
Code:
SetTimer, SnoopPrevention, 250

SnoopPrevention:
WinGet, Min, MinMax, Secret Chat,
IfEqual Min, -1
 {
  Pass =
  ChatLimit =
  TypeLimit =
  EncryptText =
  DecryptText =
  TextTransform =
  SendTo =
  ControlSetText Edit1, , Secret Chat
  ControlSetText Edit2, , Secret Chat
  ControlSetText Edit3, , Secret Chat
  ControlSetText Edit4, , Secret Chat
  GUI, Submit
  GUI Minimize
  SetTimer, SnoopPrevention, Off
  SetTimer, Reengage, 250
 }
Return

Reengage:
WinGet, Min, MinMax, Secret Chat,
IfNotEqual Min, -1
{
  SetTimer, SnoopPrevention, 250
  SetTimer, Reengage, off
}
Return


The code, like this, only will hide the "Secret Chat in ..." window, then bring it back. It won't change the window's title.

In the main GUI, for the title, I have it say:
Code:
;Title
IfNotEqual, SendTo,
   WinTitle = Secret Chat in %Title%
Else
  WinTitle = Secret Chat
Gui, Show, h433 w334, %WinTitle%


Any help would be appreciated.
_________________
Scott F Couchman
Back to top
View user's profile Send private message AIM Address MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Thu Jun 12, 2008 7:45 pm    Post subject: Reply with quote

I suggest you Hide/Show the GUI and here is an example:

Code:
Gui +LastFound
Gui1 := WinExist()
Gui, Show, w640 h480, My Secret GUI

#Z:: ; Win+Z is the bosskey
  If DllCall( "IsWindowVisible", UInt,Gui1 )
     WinHide ahk_id %Gui1%
  Else
     WinShow ahk_id %Gui1%
Return


Smile
_________________
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Thu Jun 12, 2008 7:51 pm    Post subject: Reply with quote

Anyways.. here is one method to change the GUI Title:

Code:
Gui, Show, w640 h480, Demo Window

#Z:: ; Win+Z is the bosskey
  GuiHide := !GuiHide
  IfEqual,GuiHide,%True%, Gui,Show,,My Secret GUI 
  Else                    Gui,Show,,Demo Window
Return


Smile
_________________
Back to top
View user's profile Send private message
scouchman



Joined: 28 Apr 2004
Posts: 45

PostPosted: Thu Jun 12, 2008 8:37 pm    Post subject: Reply with quote

Thanks for these ideas, but what I'm looking for is when the window is minimized to the task bar it will change, and ideally not with a special key, but just when it would normally be minimized.

The first way you have, will hide it from the task bar and bring it back with the hotkey.

The second way, if I have the the window minimized and try the hotkey (which is essentially what I'm doing in my code, but yours looks a lot cleaner), it will pop up the window to change the name, it won't change the name and keep the window minimized, which is what I'm looking for.
_________________
Scott F Couchman
Back to top
View user's profile Send private message AIM Address MSN Messenger
Z Gecko
Guest





PostPosted: Thu Jun 12, 2008 8:45 pm    Post subject: Reply with quote

I assume you are talking about an ahk-made GUI.
To change the title of a GUI when minimized, you could use:
Code:

GuiSize:
If ( A_EventInfo = 1 )
   Gui, Show , Minimize, New GUI Title
return
Back to top
scouchman



Joined: 28 Apr 2004
Posts: 45

PostPosted: Thu Jun 12, 2008 9:05 pm    Post subject: Reply with quote

Thanks, Z Gecko, that's it. Man, thought I tried that and got an error, so threw out the idea. Prolly just a typo. Laughing
_________________
Scott F Couchman
Back to top
View user's profile Send private message AIM Address MSN Messenger
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