| 1 |
|
|---|
| 2 |
|
|---|
| 3 | #include <GuiToolbar.au3>
|
|---|
| 4 | #include <GuiToolTip.au3>
|
|---|
| 5 | #include <GuiConstantsEx.au3>
|
|---|
| 6 | #include <WindowsConstants.au3>
|
|---|
| 7 | #include <Constants.au3>
|
|---|
| 8 |
|
|---|
| 9 | Opt('MustDeclareVars', 1)
|
|---|
| 10 |
|
|---|
| 11 | $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
|
|---|
| 12 | Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp
|
|---|
| 13 |
|
|---|
| 14 | _Main()
|
|---|
| 15 |
|
|---|
| 16 | Func _Main()
|
|---|
| 17 | Local $hGUI, $hToolbar, $hToolTip
|
|---|
| 18 |
|
|---|
| 19 | ; Create GUI
|
|---|
| 20 | $hGUI = GUICreate("Toolbar", 400, 300)
|
|---|
| 21 | $hToolbar = _GUICtrlToolbar_Create($hGUI)
|
|---|
| 22 | GUISetState()
|
|---|
| 23 |
|
|---|
| 24 | ; Create ToolTip
|
|---|
| 25 | $hToolTip = _GUIToolTip_Create($hToolbar)
|
|---|
| 26 | _GUICtrlToolbar_SetToolTips($hToolbar, $hToolTip)
|
|---|
| 27 |
|
|---|
| 28 | ; Add standard system bitmaps
|
|---|
| 29 | Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
|
|---|
| 30 | Case 0
|
|---|
| 31 | _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
|
|---|
| 32 | Case 2
|
|---|
| 33 | _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
|
|---|
| 34 | EndSwitch
|
|---|
| 35 |
|
|---|
| 36 | ; Add buttons
|
|---|
| 37 | _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
|
|---|
| 38 | _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
|
|---|
| 39 | _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
|
|---|
| 40 | _GUICtrlToolbar_AddButtonSep($hToolbar)
|
|---|
| 41 | _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
|
|---|
| 42 |
|
|---|
| 43 | ; Show ToolTip handle
|
|---|
| 44 | MsgBox(4096, "Information", "ToolTip handle .: 0x" & Hex(_GUICtrlToolbar_GetToolTips($hToolbar)))
|
|---|
| 45 |
|
|---|
| 46 | ; Loop until user exits
|
|---|
| 47 | GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
|
|---|
| 48 |
|
|---|
| 49 | ; Loop until user exits
|
|---|
| 50 | Do
|
|---|
| 51 | Until GUIGetMsg() = $GUI_EVENT_CLOSE
|
|---|
| 52 |
|
|---|
| 53 | EndFunc ;==>_Main
|
|---|
| 54 |
|
|---|
| 55 | ; Handle WM_NOTIFY messages
|
|---|
| 56 | Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
|
|---|
| 57 | Local $tInfo, $iID, $iCode
|
|---|
| 58 |
|
|---|
| 59 | $tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam)
|
|---|
| 60 | $iCode = DllStructGetData($tInfo, "Code")
|
|---|
| 61 | If $iCode = $TTN_GETDISPINFO Then
|
|---|
| 62 | $iID = DllStructGetData($tInfo, "IDFrom")
|
|---|
| 63 | Switch $iID
|
|---|
| 64 | Case $idNew
|
|---|
| 65 | DllStructSetData($tInfo, "aText", "New")
|
|---|
| 66 | Case $idOpen
|
|---|
| 67 | DllStructSetData($tInfo, "aText", "Open")
|
|---|
| 68 | Case $idSave
|
|---|
| 69 | DllStructSetData($tInfo, "aText", "Save")
|
|---|
| 70 | Case $idHelp
|
|---|
| 71 | DllStructSetData($tInfo, "aText", "Help")
|
|---|
| 72 | EndSwitch
|
|---|
| 73 | EndIf
|
|---|
| 74 | Return $GUI_RUNDEFMSG
|
|---|
| 75 | EndFunc ;==>WM_NOTIFY
|
|---|