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 

Remove Minimize / Maximize Button from Titlebar

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



Joined: 14 Sep 2006
Posts: 31

PostPosted: Mon Jun 30, 2008 2:15 pm    Post subject: Remove Minimize / Maximize Button from Titlebar Reply with quote

Hi

I want to remove minimize and maximize button from a running program (for exampel Notepad.exe)

From what I can understand this should be doable with "setwindowlong" function in the winapi.

After I get a handle to the Notepad I use "getwindowlong" to read the style (GWL_STYLE = -16)... and that works fine.

But after I change the windowstyle (a style without WS_MINIMIZEBOX and WS_MAXIMIZEBOX ) and apply it with "setwindowlong" nothing happens =(

Maybe Notepad.exe ignores the WM_STYLECHANGE message but then again the transparenty app posted on this foum works ok with notepad.
http://www.autohotkey.com/forum/viewtopic.php?t=698

I did my testing with VisualBasic 2008 Express since im not that good with autohotkey and the windows api =/

Anyone that knows anything about this and could help me get on track ?

Maybe it's impossible to apply a new window style to a program that is already running... maybe I need to send a WM_PAINT message to the window or something... well im pretty lost.

Any help is helpful Very Happy

///Ricke
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Mon Jun 30, 2008 2:44 pm    Post subject: Re: minimizebutton removal (using setwindowlong) Reply with quote

ricke wrote:
I want to remove minimize and maximize button from a running program (for exampel Notepad.exe)


Code:
^F2::WinSet, Style, -0x30000, A ; WS_MAXIMIZEBOX 0x10000 + WS_MINIMIZEBOX 0x20000
^F3::WinSet, Style, +0x30000, A ; WS_MAXIMIZEBOX 0x10000 + WS_MINIMIZEBOX 0x20000


Run the above code. Ctrl+F2 will remove the buttons and Ctrl+F3 would bring them back.

Smile

Edit:

On a related note, The following creates a ToolWindow alike window, but with a regular-sized Titlebar and show in Alt-Tab:

Code:
Gui 1:+Owner -0x30000
Gui, 1:Show, w640 h480

_________________


Last edited by SKAN on Tue Jul 01, 2008 10:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
ricke



Joined: 14 Sep 2006
Posts: 31

PostPosted: Mon Jun 30, 2008 2:46 pm    Post subject: Reply with quote

wow..

thanx alot man =)
Back to top
View user's profile Send private message
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