Sign in to follow this  
Followers 0
smashly

How to Block or Disable or Hide window close button?

9 posts in this topic

#1 ·  Posted (edited)

Is there any way for AutoIt to Block or Disable or Hide the Close button of a running program while still leaving the rest of the running program window enabled?

By Close button I mean the X on upper right of the title bar .

I did have a search for an answer , but I guess I'm not using the correct Key words in my search.

tyia for any response.

Cheers.

Edited by smashly

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I hope i get it right [this is to disable]

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ;;;
    EndSelect
WEnd

notice the ;;; its a NOP for Exitloop

Edited by geocine

Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%

Share this post


Link to post
Share on other sites

Hi and thank you for the responses,

It's to make my autoit utilitray script complete(ish)..lol

basicly I've made tray menu that lets me add my prefered shortcuts to it.

I've added what I call advanced options on how the added tray menu shortcuts can be launched.

Currently it supports 10 user defined tray menu items that can be configured through the "Add & Remove & Edit Configure Shortcut" window which is accessed through the utilitray tray menu.

eg:

Name To Display in tray menu

Program to run

Parameters

Run Program Hidden

Hide & Show Program

Stop & Start Program <----- For this I'd like to disable the programs X close button

Close program on exit of utilitray

Lock Program Window

Load last exit state when utilitray is launched.

The progam utilitray launches could be any program at all.

The script is around 4000+ lines at present and works ok.

I have no problem with AutoIt Gui windows and removing , blocking , dissabling the X close as I can set the gui style and etended styles to suite.

But when it comes to a non autoit program and trying to do the same thing I can't see an easy way to do what I'm after.

Surely there's a niffty neat way to do it ?

Can post my bodgey utilitray script if need be , but I don't see it helping any to get a resolve.

It's not a script problem it's just a function I was hoping possible

Cheers.

Share this post


Link to post
Share on other sites

oh. thats interesting.. if possible.. share that script to me.. we are both noobs here hahaha but im much of a noob.


Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%

Share this post


Link to post
Share on other sites

This will take care of the menu for the most part (menu close), but it doesn't neccessarily work on the "X" to close the app. I'm not aware of an API call that does this specifically:

$Hwnd = WinGetHandle("WindowTitle Here")

Global Const $SC_CLOSE = 0xF060

$menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $Hwnd, "int",0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

This will take care of the menu for the most part (menu close), but it doesn't neccessarily work on the "X" to close the app. I'm not aware of an API call that does this specifically:

$Hwnd = WinGetHandle("WindowTitle Here")

Global Const $SC_CLOSE = 0xF060

$menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $Hwnd, "int",0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0)
http://www.autoitscript.com/forum/index.ph...ic=6577&hl=

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

how about this

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
    EndSelect
WEnd
Edited by geocine

Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%

Share this post


Link to post
Share on other sites
Hmm, wonder how the hell I missed that one!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0