Jump to content

Window style for About Window


siva1612
 Share

Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

siva1612,

Welcome to the AutoIt forum. :)

This sounds as if it will do what you want:

#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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Modified a bit Melba's code

#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 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.

Link to comment
Share on other sites

  • Moderators

PhoenixXL,

If you disable the main GUI then you do not need the advanced GUIGetMsg in the child loop: :P

#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   ;==>_About

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

learnt a new thing :)

Thank You

Edited 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.

Link to comment
Share on other sites

The last post by melba, did the trick. though i removed the TOOL_WINDOW option.. i have some follow up questions

1) 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:"

Link to comment
Share on other sites

"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.

Link to comment
Share on other sites

  • Moderators

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 loop

Read 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

$WS_EX_TOOLWINDOW

#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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...