Sign in to follow this  
Followers 0
ReverendJ1

Help/About button

5 posts in this topic

I was wondering if there was any way when using forms with the $WS_EX_CONTEXTHELP extended style if you could make the '?' button bring up another gui (i.e. an about/help box), instead of showing tooltips.

Thank You

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>

Global Const $WM_SYSCOMMAND = 0x112;
Global Const $SC_CLOSE = 0xF060;
Global Const $SC_CONTEXTHELP = 0xF180;
Global Const $SC_DEFAULT = 0xF160;
Global Const $SC_HOTKEY = 0xF150;
Global Const $SC_KEYMENU = 0xF100;
Global Const $SC_MAXIMIZE = 0xF030;
Global Const $SC_MINIMIZE = 0xF020;
Global Const $SC_MONITORPOWER = 0xF170;
Global Const $SC_MOUSEMENU = 0xF090;
Global Const $SC_MOVE = 0xF010;
Global Const $SC_NEXTWINDOW = 0xF040;
Global Const $SC_PREVWINDOW = 0xF050;
Global Const $SC_RESTORE = 0xF120;
Global Const $SC_SCREENSAVE = 0xF140;
Global Const $SC_SIZE = 0xF000;
Global Const $SC_TASKLIST = 0xF130;
Global Const $SC_VSCROLL = 0xF070;

Dim $ContextHelp = False

;~ GUICreate("My GUI",500,500,Default,Default,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))  ; will create a dialog box that when displayed is centered
GUICreate("My GUI",500,500,Default,Default,BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX),$WS_EX_CONTEXTHELP)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box
GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND_Events")

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
        Case $ContextHelp = True
            $ContextHelp = Not $ContextHelp
            MsgBox(0,"About","Anything you want")
        EndSelect
Wend

Func WM_SYSCOMMAND_Events($hWndGUI, $MsgID, $wParam, $lParam)
    Switch $wParam
        Case $SC_CLOSE
            _DebugPrint("$SC_CLOSE")
        Case $SC_CONTEXTHELP
            _DebugPrint("$SC_CONTEXTHELP")
                $ContextHelp = True
                Return 0
        Case $SC_DEFAULT
            _DebugPrint("$SC_DEFAULT")
        Case $SC_HOTKEY
            _DebugPrint("$SC_HOTKEY")
        Case $SC_KEYMENU
            _DebugPrint("$SC_KEYMENU")
        Case $SC_MAXIMIZE
            _DebugPrint("$SC_MAXIMIZE")
        Case $SC_MINIMIZE
            _DebugPrint("$SC_MINIMIZE")
        Case $SC_MONITORPOWER
            _DebugPrint("$SC_MONITORPOWER")
        Case $SC_MOUSEMENU
            _DebugPrint("$SC_MOUSEMENU")
        Case $SC_MOVE
            _DebugPrint("$SC_MOVE")
        Case $SC_NEXTWINDOW
            _DebugPrint("$SC_NEXTWINDOW")
        Case $SC_PREVWINDOW
            _DebugPrint("$SC_PREVWINDOW")
        Case $SC_RESTORE
            _DebugPrint("$SC_RESTORE")
        Case $SC_SCREENSAVE
            _DebugPrint("$SC_SCREENSAVE")
        Case $SC_SIZE
            _DebugPrint("$SC_SIZE")
        Case $SC_TASKLIST
            _DebugPrint("$SC_CLOSE")
        Case $SC_VSCROLL
            _DebugPrint("$SC_VSCROLL")
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func _HiWord($x)
    Return BitShift($x, 16)
EndFunc   ;==>_HiWord 

Func _LoWord($x)
    Return BitAND($x, 0xFFFF)
EndFunc   ;==>_LoWord 

Func _DebugPrint($s_text)
    $s_text = StringReplace(StringReplace($s_text, @CRLF, @LF), @LF, @LF & "!-->")
    ConsoleWrite( _
            "+===========================================================" & @LF & _
            "!-->" & $s_text & @LF & _
            "+===========================================================" & @LF & @LF)
EndFunc   ;==>_DebugPrint


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

Thanks gafrost! Took me a while to figure out what I had to do with your code (first I just copied and pasted into a blank script), I kept getting this error:

C:\Deleteme\test.au3(80,26) : WARNING: $GUI_RUNDEFMSG: possibly used before declaration.

Return $GUI_RUNDEFMSG

~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Deleteme\test.au3(80,26) : ERROR: $GUI_RUNDEFMSG: undeclared global variable.

Return $GUI_RUNDEFMSG

~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Deleteme\test.au3(27,53) : ERROR: GUIRegisterMsg(): undefined function.

GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND_Events")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Deleteme\test.au3 - 2 error(s), 1 warning(s)

I kept trying to fix it and it wouldn't work. But then I just recopied it in it's entirety clicked continue anyway when the error came up and it worked!

Thanks a ton!

Share this post


Link to post
Share on other sites

VERY nice gafrost !! You are really good in using GUIRegisterMsg :whistle:

and it's very powerfull function.

Most of them a pretty simple actually, just a matter of finding the correct message you need to work with.

The above I posted in scripts and scraps last week (less a few lines) and another one as scrap

Gary


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

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