Jump to content

Create an about window


Recommended Posts

OMG this must be so simple but i just can't figure it out! :shocked: I want to include an about window in my program which

  • is modal
  • has only an icon to close it (not maximize n stuff)
  • preferably has an ok button by default
  • does make the entire programm exit when closed
  • can contain user defined controls such as icons and labels
MsgBox is not the right thing and i can't figure out the right line of code with GUICreate. HELP PLX! :( Edited by pwn4g3
Link to comment
Share on other sites

this is just a form with a ok button on it is that what you wanted i never did number 4 as i dont know what code that would be

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 322, 230, 193, 115)
$Button1 = GUICtrlCreateButton("AButton1", 240, 192, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Exit

    EndSwitch
WEnd

Koda is a good porgram to make guis with i use it all the time makes tings a lot easy http://www.autoitscript.com/forum/index.php?showtopic=32299

^ is the topic on koda

Edited by thenewkid

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Link to comment
Share on other sites

For your inspiration - Here is my simple version of About window with active URL labels:

#NoTrayIcon
#include <Constants.au3>
#include <GUIConstants.au3>

Opt("GUICloseOnESC",1)
Opt("GUIOnEventMode",1)

$about = GuiCreate("About",215,150,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU))
GUISetOnEvent ($GUI_EVENT_CLOSE, "AboutOK" )
GUICtrlCreateIcon (@AutoItExe,-1,11,11)
GUICtrlCreateLabel ("App name 1.0",59,11,135,20)
GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold
GUICtrlCreateLabel ("(c) 2005" & @CRLF & @CRLF & "Zedna",59,30,135,40)
$email = GUICtrlCreateLabel ("author@somewhere.com",59,70,135,15)
GuiCtrlSetFont($email, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($email,0x0000ff)
GuiCtrlSetCursor($email,0)
GUICtrlSetOnEvent(-1, "OnEmail")
$www = GUICtrlCreateLabel ("www.autoitscript.com/forum/",59,85,140,15)
GuiCtrlSetFont($www, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($www,0x0000ff)
GuiCtrlSetCursor($www,0)
GUICtrlSetOnEvent(-1, "OnWWW")
GUICtrlCreateButton ("OK",65,115,75,23,BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUICtrlSetState (-1, $GUI_FOCUS)
GUICtrlSetOnEvent(-1, "AboutOK")
GUISetState(@SW_SHOW, $about)

While 1 
    Sleep(100)
WEnd

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:author@somewhere.com?subject=Something', "", @SW_HIDE)
EndFunc

Func OnWWW()
    Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE)
EndFunc

Func AboutOK()
    Exit
EndFunc

Func OnAutoItExit()
    GUIDelete($about)
EndFunc
Edited by Zedna
Link to comment
Share on other sites

Hi,

Here is my version to "About Window" (not so simple, but cool :shocked: ), it's used like an UDF function:

#include <GUIConstants.au3>

$Title = "About Info"

$MainLabel = "My program Name"
$CopyRLabel = "Copyright © " & @YEAR & " Company/Author. All rights reserved."

$NameURL1 = "App Web Page"
$URL1 = "http://www.autoitscript.com"
$NameURL2 = "Email"
$URL2 = "mailto:creat0rx@yahoo.com"
$NameURL3 = "Some additional link"
$URL3 = "http://personalwebpafe.com"
$LinkColor = 0x0000FF
$BkColor = 0xFFFFFF

$hWnd = WinGetHandle(WinGetTitle(""))

_About($Title, $MainLabel, $CopyRLabel, "v1.0", $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, @AutoItExe, $LinkColor, $BkColor, -1, -1, -1, -1, $hWnd)

Func _About($Title, $MainLabel, $CopyRLabel, $VerLabel, $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, $IconFile="", $LinkColor=0x0000FF, $BkColor=0xFFFFFF, $Left=-1, $Top=-1, $Style=-1, $ExStyle=-1, $Parent=0)
    Local $OldEventOpt = Opt("GUIOnEventMode", 0)
    Local $OldRunErrOpt = Opt("RunErrorsFatal", 0)
    Local $GUI, $LinkTop=120, $Msg
    Local $CurIsOnCtrlArr[1]
    
    Local $LinkVisitedColor[4] = [3, $LinkColor, $LinkColor, $LinkColor]
    Local $LinkLabel[4]
    
    WinSetState($Parent, "", @SW_DISABLE)
    
    If $ExStyle = -1 Then $ExStyle = ""
    $GUI = GUICreate($Title, 320, 240, $Left, $Top, $Style, 0x00000080+$ExStyle, $Parent)
    GUISetBkColor($BkColor)

    GUICtrlCreateLabel($MainLabel, 40, 20, 280, 25, 1)
    GUICtrlSetFont(-1, 16)

    GUICtrlCreateIcon($IconFile, 0, 10, 20)

    GUICtrlCreateGraphic(5, 75, 310, 3, $SS_ETCHEDFRAME)
    
    For $i = 1 To 3
        $LinkLabel[$i] = GUICtrlCreateLabel(Eval("NameURL" & $i), 150, $LinkTop, 145, 15, 1)
        GUICtrlSetCursor(-1, 0)
        GUICtrlSetColor(-1, $LinkColor)
        GUICtrlSetFont(-1, 9, 400, 0)
        $LinkTop += 30
    Next

    GUICtrlCreateLabel("Program version: " & @LF & $VerLabel, 10, 130, 150, 35, 1)
    GUICtrlSetFont(-1, 10, 600, 0, "Tahoma")
    
    GUICtrlCreateLabel($CopyRLabel, 0, 220, 320, -1, 1)

    GUISetState(@SW_SHOW, $GUI)

    While 1
        $Msg = GUIGetMsg()
        If $Msg = -3 Then ExitLoop
        For $i = 1 To 3
            If $Msg = $LinkLabel[$i] Then
                $LinkVisitedColor[$i] = 0xAC00A9
                GUICtrlSetColor($LinkLabel[$i], $LinkVisitedColor[$i])
                ShellExecute(Eval("URL" & $i))
            EndIf
        Next
        If WinActive($GUI) Then
            For $i = 1 To 3
                ControlHover($GUI, $LinkLabel[$i], $i, $CurIsOnCtrlArr, 0xFF0000, $LinkVisitedColor[$i])
            Next
        EndIf
    WEnd
    WinSetState($Parent, "", @SW_ENABLE)
    GUIDelete($GUI)
    Opt("GUIOnEventMode", $OldEventOpt)
    Opt("RunErrorsFatal", $OldRunErrOpt)
EndFunc

Func ControlHover($hWnd, $CtrlID, $CtrlNum, ByRef $CurIsOnCtrlArr, $HoverColor=0xFF0000, $LinkColor=0x0000FF)
    Local $CursorCtrl = GUIGetCursorInfo($hWnd)
    ReDim $CurIsOnCtrlArr[UBound($CurIsOnCtrlArr)+1]
    If $CursorCtrl[4] = $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 1 Then
        GUICtrlSetFont($CtrlID, 9, 400, 6)
        GUICtrlSetColor($CtrlID, $HoverColor)
        $CurIsOnCtrlArr[$CtrlNum] = 0
    ElseIf $CursorCtrl[4] <> $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 0 Then
        GUICtrlSetFont($CtrlID, 9, 400, 0)
        GUICtrlSetColor($CtrlID, $LinkColor)
        $CurIsOnCtrlArr[$CtrlNum] = 1
    EndIf
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 3 months later...

The solution for me was:

Opt("GUIOnEventMode", 1)

Dim $about = GUICreate([...])
GUISetOnEvent($GUI_EVENT_CLOSE, "HideInfo", $about)

Func HideInfo()
    GUISetState(@SW_HIDE, $about)
EndFunc

It seems it can only be achieved with Opt("GUIOnEventMode", 1).

Link to comment
Share on other sites

  • 1 month later...

Zedna, can I modify your 'About' GUI and use in my app?

Of course Yes :)

There was some disccusion about licences of code posted on the forum

and somebody said something like: 

Everything posted on the forum can be used without permission

If author didn't want others use his code he wouldn't post his code on the forum.

So take it/use it/be happy with it :)

Link to comment
Share on other sites

this is a very simple solution

if $msg = $about then
$child1 = GUICreate("About",220, 220,-1,-1,-1,$WS_EX_TOOLWINDOW,$parent)
$font = "Ariel"
Opt("RunErrorsFatal",0)
GUICtrlCreateLabel("My Program",50,30,150,30)
GUICtrlSetFont(-1,10,400,$font)
GUICtrlCreateIcon("my icon.ico",-1,85,65,48,48)
GUICtrlCreateLabel("Written By Me", 55,120,150,30)
GUICtrlSetFont (-1,10, 400, $font)
$aboutok = GUICtrlCreateButton ("OK",75,170,75,25)
GUISetState()
Do
$msg1 = GUIGetMsg()
if $msg1 = $aboutok then
ExitLoop
endif
Until $msg1 = $GUI_EVENT_CLOSE
GUIDelete($child1)
endif
[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

this line doesn't seem to work:

Try this:

Run(@ComSpec & ' /c start mailto:author@somewhere.com?subject=Something', '', @SW_HIDE)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

It doesn't work either

And this one?:

ShellExecute("mailto:author@somewhere.com?subject=Something")

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

That doesn't either, weird. This error message dialog appears:

:)

It looks like you have no default email program (Like Outlook for example) on your system.

What email program do you use?

Go to its preferences and check out option "Set this program as default email program" or some similar one.

Link to comment
Share on other sites

which part of your 'About' script made the window 'always on top' as well as 'tabless'(taskbar)? And it only closes when the user clicks on OK or the X button?

It's not have an "Always on top" attribute, it's just created as child for main GUI window (using last parametr in GuiCreate() Func as handle to parent Gui).

And the 'tabless effect' is because it using $WS_EX_TOOLWINDOW ExStyle (0x00000080), you can pass then $WS_EX_APPWINDOW ExStyle to _About() func to display the window on taskbar.

BTW, my example here is old and it have some issues (such as CPU increesing), i will post my new example shortly (in the Examples forum).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

How do I apply it?

I not sure what you want to apply? just add the style $WS_EX_TOOLWINDOW as ExStyle after BitOr if you do not like that the app will be displayed on the taskbar.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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