siva1612 Posted February 23, 2013 Posted February 23, 2013 Hi, I am completely confused with these window style. i need info on which styles to use, to achieve the properties of an "About" window, like the about windows that usually appear in some apps giving copyright and version infos.. the reqt.s will be like 1) when it appears the actual window should be disabled.(this i can achieve with DISABLE state) 2) should not be able to minimize the about window, by clicking the icon in the startbar( not able to achieve) 3) should not appear as a separate window in the task bar 4) on clicking close button, or a OK button, the app window should activate( if i use the SW_SHOW property to do this, it kinda appears as if all the controls were deleted and then are painted once again. i dont want that 2 happen) Anybody have any ideas?
Moderators Melba23 Posted February 23, 2013 Moderators Posted February 23, 2013 siva1612, Welcome to the AutoIt forum. This sounds as if it will do what you want: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("About", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton _About() EndSwitch WEnd Func _About() $hAbout_GUI = GUICreate("About", 200, 200, -1, -1, BitOR($WS_POPUPWINDOW, $WS_CAPTION), -1, $hGUI) $cAbout_Button = GUICtrlCreateButton("OK", 10, 10, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hAbout_GUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE, $cAbout_Button GUIDelete($hAbout_GUI) ExitLoop EndSwitch EndSwitch WEnd EndFunc Please ask if you have any questions or if it not what you wanted. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
PhoenixXL Posted February 23, 2013 Posted February 23, 2013 (edited) Modified a bit Melba's codeexpandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("About", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton GUISetState(@SW_DISABLE) _About() GUISetState(@SW_ENABLE, $hGUI) WinActivate($hGUI) EndSwitch WEnd Func _About() $hAbout_GUI = GUICreate("About", 200, 200, -1, -1, BitOR($WS_POPUPWINDOW, $WS_CAPTION), $WS_EX_TOOLWINDOW, $hGUI) $cAbout_Button = GUICtrlCreateButton("OK", 10, 10, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hAbout_GUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE, $cAbout_Button GUIDelete($hAbout_GUI) ExitLoop EndSwitch EndSwitch WEnd EndFunc ;==>_About Edited February 23, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Moderators Melba23 Posted February 23, 2013 Moderators Posted February 23, 2013 PhoenixXL,If you disable the main GUI then you do not need the advanced GUIGetMsg in the child loop: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("About", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton GUISetState(@SW_DISABLE) _About() GUISetState(@SW_ENABLE, $hGUI) WinActivate($hGUI) EndSwitch WEnd Func _About() $hAbout_GUI = GUICreate("About", 200, 200, -1, -1, BitOR($WS_POPUPWINDOW, $WS_CAPTION), $WS_EX_TOOLWINDOW, $hGUI) $cAbout_Button = GUICtrlCreateButton("OK", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cAbout_Button GUIDelete($hAbout_GUI) ExitLoop EndSwitch WEnd EndFunc ;==>_AboutM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
PhoenixXL Posted February 23, 2013 Posted February 23, 2013 (edited) learnt a new thing Thank You Edited February 23, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
siva1612 Posted February 23, 2013 Author Posted February 23, 2013 The last post by melba, did the trick. though i removed the TOOL_WINDOW option.. i have some follow up questions1) when the about window gets closed.. the controls in the main window disappear for a sec. and then come back. is it possible to avoid this?2)..jus out of curiosity.. what did you mean by this statement "If you disable the main GUI then you do not need the advanced GUIGetMsg in the child loop:"
siva1612 Posted February 23, 2013 Author Posted February 23, 2013 ok.. i was researching other threads and have found a solution.. if i enable the parent window before deleting the child window, the disappearing thing does not occur. Can anyone tell me y this happens?
PhoenixXL Posted February 23, 2013 Posted February 23, 2013 "If you disable the main GUI then you do not need the advanced GUIGetMsg in the child loop:"Check the difference in my script and melba's second script you will understand the statement My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Moderators Melba23 Posted February 23, 2013 Moderators Posted February 23, 2013 siva1612,what did you mean by this statement "If you disable the main GUI then you do not need the advanced GUIGetMsg in the child loopRead the Managing Multiple GUIs tutorial in the Wiki and all will become clear. if i enable the parent window before deleting the child window, the disappearing thing does not occur. Can anyone tell me y this happens?I imagine it is because of the order in which Windows redraws the windows. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AZJIO Posted February 23, 2013 Posted February 23, 2013 $WS_EX_TOOLWINDOWexpandcollapse popup#NoTrayIcon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $LngTitle = 'My Program' $LngAbout = 'About' $LngVer = 'Version' $LngSite = 'Site' $LngCopy = 'Copy' $hGui = GUICreate($LngTitle, 310, 175, 222, 222, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) ; If Not @Compiled Then GUISetIcon(@ScriptDir & '\My_Program.ico') $iButton = GUICtrlCreateButton('@', 310 - 40, 10, 33, 33) GUICtrlSetTip(-1, $LngAbout) GUICtrlSetResizing(-1, 4 + 32 + 256 + 512) GUISetState() While 1 Switch GUIGetMsg() Case $iButton _About() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _About() $GP = _ChildCoor($hGui, 210, 180) GUISetState(@SW_DISABLE, $hGui) $font = "Arial" $Gui1 = GUICreate($LngAbout, $GP[2], $GP[3], $GP[0], $GP[1], BitOR($WS_CAPTION, $WS_SYSMENU, $WS_POPUP), -1, $hGui) ; If Not @Compiled Then GUISetIcon(@ScriptDir & '\My_Program.ico') GUISetBkColor(0xE1E3E7) GUICtrlCreateLabel($LngTitle, 0, 0, 210, 63, 0x01 + 0x0200) GUICtrlSetFont(-1, 14, 600, -1, $font) GUICtrlSetColor(-1, 0x3a6a7e) GUICtrlSetBkColor(-1, 0xF1F1EF) GUICtrlCreateLabel("-", 2, 64, 208, 1, 0x10) GUISetFont(9, 600, -1, $font) GUICtrlCreateLabel($LngVer & ' 2.3 24.02.2013', 15, 100, 210, 17) GUICtrlCreateLabel($LngSite & ':', 15, 115, 40, 17) $url = GUICtrlCreateLabel('http://site.com', 52, 115, 170, 17) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0x0000ff) GUICtrlCreateLabel('WebMoney:', 15, 130, 85, 17) $WbMn = GUICtrlCreateLabel('00000000000', 90, 130, 125, 17) GUICtrlSetColor(-1, 0x3a6a7e) GUICtrlSetTip(-1, $LngCopy) GUICtrlSetCursor(-1, 0) GUICtrlCreateLabel('Copyright Author © 2013', 15, 145, 210, 17) GUISetState(@SW_SHOW, $Gui1) While 1 Switch GUIGetMsg() Case $url ShellExecute('http://site.com') Case $WbMn ClipPut('00000000000') Case $GUI_EVENT_CLOSE GUISetState(@SW_ENABLE, $hGui) GUIDelete($Gui1) ExitLoop EndSwitch WEnd EndFunc ;==>_About Func _ChildCoor($Gui, $w, $h, $c = 0, $d = 0) Local $aWA = _WinAPI_GetWorkingArea(), _ $GP = WinGetPos($Gui), _ $wgcs = WinGetClientSize($Gui) Local $dLeft = ($GP[2] - $wgcs[0]) / 2, _ $dTor = $GP[3] - $wgcs[1] - $dLeft If $c = 0 Then $GP[0] = $GP[0] + ($GP[2] - $w) / 2 - $dLeft $GP[1] = $GP[1] + ($GP[3] - $h - $dLeft - $dTor) / 2 EndIf If $d > ($aWA[2] - $aWA[0] - $w - $dLeft * 2) / 2 Or $d > ($aWA[3] - $aWA[1] - $h - $dLeft + $dTor) / 2 Then $d = 0 If $GP[0] + $w + $dLeft * 2 + $d > $aWA[2] Then $GP[0] = $aWA[2] - $w - $d - $dLeft * 2 If $GP[1] + $h + $dLeft + $dTor + $d > $aWA[3] Then $GP[1] = $aWA[3] - $h - $dLeft - $dTor - $d If $GP[0] <= $aWA[0] + $d Then $GP[0] = $aWA[0] + $d If $GP[1] <= $aWA[1] + $d Then $GP[1] = $aWA[1] + $d $GP[2] = $w $GP[3] = $h Return $GP EndFunc ;==>_ChildCoor Func _WinAPI_GetWorkingArea() Local Const $SPI_GETWORKAREA = 48 Local $stRECT = DllStructCreate("long; long; long; long") Local $SPIRet = DllCall("User32.dll", "int", "SystemParametersInfo", "uint", $SPI_GETWORKAREA, "uint", 0, "ptr", DllStructGetPtr($stRECT), "uint", 0) If @error Then Return 0 If $SPIRet[0] = 0 Then Return 0 Local $sLeftArea = DllStructGetData($stRECT, 1) Local $sTopArea = DllStructGetData($stRECT, 2) Local $sRightArea = DllStructGetData($stRECT, 3) Local $sBottomArea = DllStructGetData($stRECT, 4) Local $aRet[4] = [$sLeftArea, $sTopArea, $sRightArea, $sBottomArea] Return $aRet EndFunc ;==>_WinAPI_GetWorkingArea My other projects or all
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now