ich habe folgende OnMessage(0x0205, "WM_RBUTTONUP") Funktion erweitert.
Ich möchte in meiner Gui den ToolTip auch für die Meldungen der mittleren und linken MausClick detektieren
Alles funktioniert wie erhofft, der ToolTip wird angezeigt, jedoch wird der Click nun nicht an den Tab weitergeleitet
Löse ich das mit MouseGetPos ? oder geht das in diesem Fall in der Funktion?
Ich kenne SendMessage noch nicht, Tippe aber mal, wenn es einen 'weiterleiten' Schalter gibt, dann darin...
Code: Select all
;;;;; ---- :::: ----
; Ist es möglich, mit der rechten Maustaste auf die Registerkarten einer Listenansicht zu klicken?
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=83561
;OnMessage(0x0205, "WM_RBUTTONUP")
WM_RBUTTONUP(W, L, M, H) {
; WM_RBUTTONUP (0x0205) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, Right click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
Return 0
}
}
;;;;; ---- :::: ----
;OnMessage(0x0208, "WM_MBUTTONUP")
WM_MBUTTONUP(W, L, M, H) {
; WM_MBUTTONUP (0x0208) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, M click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
Return 0
}
}
;;;;; ---- :::: ----
;OnMessage(0x0202, "WM_LBUTTONUP")
WM_LBUTTONUP(W, L, M, H) {
; WM_LBUTTONUP (0x0202) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, Left click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
Return 0
}
}
Danke fürs lesen
Code: Select all
#SingleInstance force
#NoEnv
#Persistent
FileEncoding, UTF-8
SetBatchLines, -1
SetTitleMatchMode, 2
SetKeyDelay 20
SetWorkingDir, %A_ScriptDir%
ANow := A_Now
If !FileExist(A_ScriptDir "\save\")
FileCreateDir,% A_ScriptDir "\save\"
FileCopy, % A_ScriptFullPath, % A_ScriptDir "\save\" A_ScriptName " save " A_Now " .ahk"
;OnMessage(0x0202, "WM_LBUTTONUP") ; ToolTip TabName L Click
OnMessage(0x0208, "WM_MBUTTONUP") ; ToolTip TabName M Click
OnMessage(0x0205, "WM_RBUTTONUP") ; ToolTip TabName R Click
OnMessage(0x0200, "WM_MOUSEMOVE")
OnMessage(0x02A0, "WM_NCMOUSEHOVER")
OnMessage(0x02A2, "WM_NCMOUSELEAVE")
OnMessage(0x00A0, "WM_NCMOUSEMOVE")
WS_CLIPSIBLINGSTab := 0x04000000, HWND_TOP := 1, flags := (SWP_NOSIZE := 0x1) | (SWP_NOMOVE := 0x2)
oMenu := {}
oMenu["MyMenubar", 1] := {text: "&MenuEins", label: {MenuMenuA: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&a2", icon: "", label: "LABEL2"}
, {} ; separator
, {text: "&ExtraLangerNameFürDiese Schaltfläche 3", icon: "", label: "LABEL3"}
, {text: "&d4", icon: "", label: "LABEL4"}
, {text: "&e5", icon: "", label: "LABEL5"}
, {text: "&f6", icon: "", label: "LABEL6"}
, {text: "&g7", icon: "", label: "LABEL7"}
, {text: "&h8", icon: "", label: "LABEL8"}
, {text: "&i9", icon: "", label: "LABEL9"}
, {text: "&i10", icon: "", label: "LABEL10"}
, {text: "&i11", icon: "", label: "LABEL11"}
, {text: "&i12", icon: "", label: "LABEL12"}
, {text: "&i13", icon: "", label: "LABEL13"}
, {text: "&i14", icon: "", label: "LABEL14"}
, {text: "&i15", icon: "", label: "LABEL15"}
, {text: "&i16", icon: "", label: "LABEL16"}
, {text: "&i17", icon: "", label: "LABEL17"}
, {text: "&i18", icon: "", label: "LABEL18"}
, {text: "&i19", icon: "", label: "LABEL19"}
, {text: "&i20", icon: "", label: "LABEL20"}
, {text: "&i21", icon: "", label: "LABEL21"}
, {text: "&i22", icon: "", label: "LABEL22"}
, {text: "&i23", icon: "", label: "LABEL23"}
, {text: "&i24", icon: "", label: "LABEL24"}
, {text: "&i25", icon: "", label: "LABEL25"}
, {text: "&i26", icon: "", label: "LABEL26"}
, {text: "&i27", icon: "", label: "LABEL27"}
, {text: "&i28", icon: "", label: "LABEL28"}
, {text: "&i29", icon: "", label: "LABEL29"}
, {text: "&i30", icon: "", label: "LABEL30"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 2] := {text: "&MenuZwei", label: {MenuMenuB: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&a2", icon: "", label: "LABEL2"}
, {} ; separator
, {text: "&ExtraLangerNameFürDiese Schaltfläche 3", icon: "", label: "LABEL3"}
, {text: "&d4", icon: "", label: "LABEL4"}
, {text: "&e5", icon: "", label: "LABEL5"}
, {text: "&f6", icon: "", label: "LABEL6"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 3] := {text: "&MenuDrei", label: {MenuMenuC: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 4] := {text: "&MenuVier", label: {MenuMenuD: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 5] := {text: "&MenuFuenf", label: {MenuMenuE: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 6] := {text: "&MenuSechs", label: {MenuMenuF: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
oMenu["MyMenubar", 7] := {text: "&MenuSieben", label: {MenuMenuG: [{text: "&aLABEL1", icon: "", label: "LABEL1"}
, {text: "&i31", icon: "", label: "LABEL32"} ]}}
Gui, Main:New
Gui, Main:Menu, % CreateMenu(oMenu)
Gui, Main:+hwndMain +MinimizeBox +ToolWindow +Caption -AlwaysOnTop
Gui, Main:Margin, 0, 0
Gui, Main:font, s11
Gui, Main:Color, FFDD99
Gui, Main:Add, Tab2, w900 h800 +0x8 Buttons cBlack -Background -Wrap gTabLabel vTabName hwndHTab ; AltSubmit
, TabEins|TabZwei|TabDrei|TabVier ; test
Gui, Main:Tab, TabZwei,, Exact
Gui, Main:Add, CheckBox, x20 y40 w300 vWMoff -checked hwndHWMoff gWM_MOUSEMOVE,% "WM_MOUSEMOVE" HWMoff
Gui, Main:Add, CheckBox, x20 y+20 w300 vWMoffa +checked hwndHWMoffA gWM_NCMOUSEHOVER,% "WM_NCMOUSEHOVER" HWMoffA
Gui, Main:Add, CheckBox, x20 y+20 w300 vWMoffb +checked hwndHWMoffB gWM_NCMOUSELEAVE,% "WM_NCMOUSELEAVE" HWMoffB
Gui, Main:Add, CheckBox, x20 y+20 w300 vWMoffc +checked hwndHWMoffC gWM_NCMOUSEMOVE,% "WM_NCMOUSEMOVE" HWMoffC
Gui, Main:Add, Button, x20 y+20 w300 vTollerTip +checked hwndHTollerTip gTollerTip,% "TollerTip" HTollerTip
; Gui, Main:Add, Text, x8 y530 w200 h200 +hwndHTEXTA +Border +%WS_CLIPSIBLINGS%,% "I don't overlap the ChildA window`n" HTEXTA
Gui, Main:Add, Button, x8 y490 +hwndHBUTTONA gBUTTONA,% "HBUTTONA" HBUTTONA
; Gui, Main:Add, Text, x150 y50 vTextA cRed, WantTab
Gui, Main:Tab, TabEins,, Exact
Gui, ChildA:New, +ParentMain +hwndHChildAGuiA -ToolWindow -Caption +%WS_CLIPSIBLINGSA%
Gui, ChildA:Color, FFDD11
Gui, ChildA: add, ListView, w860 h180 vLVA +hwndHChieldListViewA Grid cBlack AltSubmit -Readonly BackgroundFFDD99 +LV0x00010000 +LV0x20
, 1|2|3
LV_Add("", "vLVA", "test")
Gui, ChildA:Show, x8 y70,% "ChildAGuiA " HChildAGuiA A_Space HChieldListViewA
Gui, ChildB:New, +ParentMain +hwndHChildAGuiA -ToolWindow -Caption +%WS_CLIPSIBLINGSB%
Gui, ChildB:Color, FFDD11
Gui, ChildB: add, ListView, w860 h180 vLVB +hwndHChieldListViewB Grid cBlack -Readonly BackgroundFFDD99 +LV0x00010000 +LV0x20 ; AltSubmit
, 1|2|3
LV_Add("", "vLVB", "test") ; fail
Gui, ChildB:Show, x8 y250,% "ChildAGuiB " HChildAGuiB A_Space HChieldListViewB
;https://autohotkey.com/board/topic/8144-uncle-davids-snippets-1-graphics-demo-analog-clock/
2pi := 2*3.1415926
Gui, ChildC:New, -Caption +ParentMain +hwndHChildAGuiC ;+%WS_CLIPSIBLINGSC%
hwndA := HChildAGuiC
Winset, Transparent, 70, ahk_id %HChildAGuiC%
Winset,Transcolor,12345 70, ahk_id %HChildAGuiC%
Gosub, ONCEONLY
Gui, ChildC:Show, x400 y530 W%_ww% H%_hh%,% "ChildAGuiC " HChildAGuiC A_Space HChieldListViewC
Gui, Main:Show, w900 h800,% main
SetTimer,working,500
Gosub working ; kick straight in
DllCall("SetWindowPos", "Ptr", HTab, "Ptr", HWND_TOP, "Int", 0, "Int", 0, "Int", 0, "Int", 0, "UInt", flags)
;DllCall("SetWindowPos", "Ptr", HChildAGuiA, "Ptr", HWND_TOP, "Int", 0, "Int", 0, "Int", 0, "Int", 0, "UInt", flags)
;DllCall("SetWindowPos", "Ptr", HChildAGuiB, "Ptr", HWND_TOP, "Int", 0, "Int", 0, "Int", 0, "Int", 0, "UInt", flags)
;DllCall("SetWindowPos", "Ptr", HChildAGuiC, "Ptr", HWND_TOP, "Int", 0, "Int", 0, "Int", 0, "Int", 0, "UInt", flags)
GuiControl,,% HTollerTip,% "TollerTip: " HTollerTip
GuiControl,,% HBUTTONA,% HBUTTONA
GuiControl,,% HTEXTA,% HTEXTA
GuiControl,,% HWMoff,% "WM_MOUSEMOVE[ " HWMoff " ]"
GuiControl,,% HWMoffA,% "WM_NCMOUSEHOVER[ " HWMoffA " ]"
GuiControl,,% HWMoffB,% "WM_NCMOUSELEAVE[ " HWMoffB " ]"
GuiControl,,% HWMoffC,% "WM_NCMOUSEMOVE[ " HWMoffC " ]"
Gui, ChildA:Default
Gui, ChildA:ListView, LVA
LV_Add("", "HChildAGuiA", HChildAGuiA)
LV_Add("", "vLVA", LVA)
Loop, % LV_GetCount("Columns")
LV_ModifyCol(A_Index, "AutoHdr")
Gui, ChildB:Default
Gui, ChildB:ListView, LVB
LV_Add("", "HChildAGuiB", HChildAGuiB)
LV_Add("", "vLVB", LVB)
Loop, % LV_GetCount("Columns")
LV_ModifyCol(A_Index, "AutoHdr")
;Gui, ChildA:Show, hide
;Gui, ChildB:Show, hide
;Gui, ChildC:Show, hide
OnMessage(0x0200, "")
OnMessage(0x02A0, "")
OnMessage(0x02A2, "")
OnMessage(0x00A0, "")
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TabLabel:
;return
gui, Main:submit, nohide
if inStr(TabName,"TabEins")
{
Gui, ChildA:Show
Gui, ChildB:Show
Gui, ChildC:Show
}
if inStr(TabName,"TabZwei")
{
Gui, ChildA:Show,Hide
Gui, ChildB:Show
Gui, ChildC:Show
}
if inStr(TabName,"TabDrei")
{
Gui, ChildA:Show,Hide
Gui, ChildB:Show,Hide
Gui, ChildC:Show
}
if inStr(TabName,"TabVier")
{
Gui, ChildA:Show,Hide
Gui, ChildB:Show,Hide
Gui, ChildC:Show,Hide
}
SplashTexton,300,350,zeile:%a_lineNumber%`gui submit infos,% "A_Gui:`t" A_Gui "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_DefaultGui :`t" A_DefaultGui "`n"
. "A_DefaultListView :`t" A_DefaultListView "`n"
. "A_GuiControlEvent:`t" A_GuiControlEvent "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_Tab:`t" A_Tab "`n"
. "A_ThisLabel:`t" A_ThisLabel "`n"
. "A_ThisHotkey:`t" A_ThisHotkey "`n"
. "A_ThisFunc:`t" A_ThisFunc "`n"
. "A_ThisMenu:`t" A_ThisMenu "`n"
. "A_ThisMenuItem:`t" A_ThisMenuItem "`n"
. "A_ThisMenuItemPos:`t" A_ThisMenuItemPos "`n"
. "A_TimeSinceThisHotkey:`t" A_TimeSinceThisHotkey "`n"
. "HTab:`t" HTab "`n"
. "TabName:`t" TabName
SetTimer, SplashTextonOFFLabel, -1
/*
MsgBox,4096,zeile:%a_lineNumber%`gui submit infos,% "A_Gui:`t" A_Gui "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_DefaultGui :`t" A_DefaultGui "`n"
. "A_DefaultListView :`t" A_DefaultListView "`n"
. "A_GuiControlEvent:`t" A_GuiControlEvent "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_Tab:`t" A_Tab "`n"
. "A_ThisLabel:`t" A_ThisLabel "`n"
. "A_ThisHotkey:`t" A_ThisHotkey "`n"
. "A_ThisFunc:`t" A_ThisFunc "`n"
. "A_ThisMenu:`t" A_ThisMenu "`n"
. "A_ThisMenuItem:`t" A_ThisMenuItem "`n"
. "A_ThisMenuItemPos:`t" A_ThisMenuItemPos "`n"
. "A_TimeSinceThisHotkey:`t" A_TimeSinceThisHotkey "`n"
. "HTab:`t" HTab "`n"
. "TabName:`t" TabName,1
*/
return
SplashTextonOFFLabel:
sleep, 1000
SplashTextoff
return
; %TabName%:
tabzwei_:
MsgBox,4096,zeile:%a_lineNumber%`gui submit infos,% "A_Gui:`t" A_Gui "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_DefaultGui :`t" A_DefaultGui "`n"
. "A_DefaultListView :`t" A_DefaultListView "`n"
. "A_GuiControlEvent:`t" A_GuiControlEvent "`n"
. "A_GuiControl:`t" A_GuiControl "`n"
. "A_Tab:`t" A_Tab "`n"
. "A_ThisLabel:`t" A_ThisLabel "`n"
. "A_ThisHotkey:`t" A_ThisHotkey "`n"
. "A_ThisFunc:`t" A_ThisFunc "`n"
. "A_ThisMenu:`t" A_ThisMenu "`n"
. "A_ThisMenuItem:`t" A_ThisMenuItem "`n"
. "A_ThisMenuItemPos:`t" A_ThisMenuItemPos "`n"
. "A_TimeSinceThisHotkey:`t" A_TimeSinceThisHotkey "`n"
. "HTab:`t" HTab "`n"
. "TabName:`t" TabName
return
TollerTip:
Gui, tip:new
Gui, tip:-Caption +AlwaysOnTop +Owner +LastFound +E0x20
WinSet, TransColor, EEAA99
Gui, tip:Color, EEAA99
Gui, tip:Font, s32 w700 q4, Times New Roman
Gui, tip:Add, Text,,% TollerTipVar ? TollerTipVar : HTollerTip
Gui, tip:Show, NA
setTimer, TollOffTimer, -1
return
TollerTipFunc(TollerTipVar := "") {
Gui, tip:new
Gui, tip:-Caption +AlwaysOnTop +Owner +LastFound +E0x20
WinSet, TransColor, EEAA99
Gui, tip:Color, EEAA99
Gui, tip:Font, s32 w700 q4, Times New Roman
Gui, tip:Add, Text,,% TollerTipVar ? TollerTipVar : HTollerTip
Gui, tip:Show, NA
setTimer, TollOffTimer, -1
}
TollOffTimer() {
Global TollerTipVar
sleep,% 1000
Gui, tip:destroy
TollerTipVar =
}
/*
#t:: ; Press Win+T to make the color under the mouse cursor invisible.
MouseGetPos, MouseX, MouseY, MouseWin
PixelGetColor, MouseRGB, %MouseX%, %MouseY%, RGB
; It seems necessary to turn off any existing transparency first:
WinSet, TransColor, Off, ahk_id %MouseWin%
WinSet, TransColor, %MouseRGB% 220, ahk_id %MouseWin%
return
#o:: ; Press Win+O to turn off transparency for the window under the mouse.
MouseGetPos,,, MouseWin
WinSet, TransColor, Off, ahk_id %MouseWin%
return
#g:: ; Press Win+G to show the current settings of the window under the mouse.
MouseGetPos,,, MouseWin
WinGet, Transparent, Transparent, ahk_id %main%
WinGet, TransColor, TransColor, ahk_id %main%
ToolTip Translucency:`t%Transparent%`nTransColor:`t%TransColor%
return
*/
;;;;; ---- :::: ---- BUTTONA:
BUTTONA:
SetTimer BUTTONATiMER,% (BUTTONATiMER:=!BUTTONATiMER)?-20:"Off"
BUTTONATiMER:
TollerTipVar := HBUTTONA
gosub TollerTip
ToolTip,% HBUTTONA
SetTimer, ToolTipOff, -2500
return
;;;;; ---- :::: ---- WMoff:
WM_MOUSEMOVE:
gui, Main:submit, nohide
if WMoff
{
OnMessage(0x0200, "WM_MOUSEMOVE")
OnMessage(0x02A0, "WM_NCMOUSEHOVER")
OnMessage(0x02A2, "WM_NCMOUSELEAVE")
OnMessage(0x00A0, "WM_NCMOUSEMOVE")
;Gui, ChildA:Show
Gui, ChildB:Show
Gui, ChildC:Show
}
else
{
SetTimer, ToolTipOff, -2500
OnMessage(0x0200, "")
OnMessage(0x02A0, "")
OnMessage(0x02A2, "")
OnMessage(0x00A0, "")
Gui, ChildA:Show, hide
Gui, ChildB:Show, hide
Gui, ChildC:Show, hide
}
return
WM_NCMOUSEHOVER:
Gui, Main:submit, nohide
if WMoffA
OnMessage(0x02A0, "WM_NCMOUSEHOVER")
else {
SetTimer, ToolTipOff, -2500
OnMessage(0x02A0, "")
}
return
WM_NCMOUSELEAVE:
Gui, Main:submit, nohide
if WMoffB
OnMessage(0x02A2, "WM_NCMOUSELEAVE")
else {
SetTimer, ToolTipOff, -2500
OnMessage(0x02A2, "")
}
return
WM_NCMOUSEMOVE:
Gui, Main:submit, nohide
if WMoffC
OnMessage(0x00A0, "WM_NCMOUSEMOVE")
else {
SetTimer, ToolTipOff, -2500
OnMessage(0x00A0, "")
}
return
LABEL1:
LABEL2:
LABEL3:
LABEL4:
LABEL5:
LABEL6:
LABEL7:
LABEL8:
LABEL9:
LABEL10:
LABEL11:
LABEL12:
LABEL13:
LABEL14:
LABEL15:
LABEL16:
LABEL17:
LABEL18:
LABEL19:
LABEL20:
LABEL21:
LABEL22:
LABEL23:
LABEL24:
LABEL25:
LABEL26:
LABEL27:
LABEL28:
LABEL29:
LABEL30:
LABEL31:
LABEL32:
return
;;;;; ---- :::: ---- ToolTipOff:
ToolTipOff:
ToolTip
return
;;;;; ---- :::: ----
WM_MOUSEMOVE(wparam, lparam, msg, hwnd) {
LLOW := ((lParam >> 16) & 0xFFFF)
LHIGH := (lParam & 0xFFFF)
LhexLOW := ("0x" . Format("{:X}", ((lParam >> 16) & 0xFFFF)))
LhexHIGH := ("0x" . Format("{:X}", (lParam & 0xFFFF)))
xhwnd := _wparam(AThisFunc, hwnd)
ToolTip,% "AThisFunc:`n" A_ThisFunc "`nwparam:`n" wparam "`n" (_wparam(AThisFunc, wparam)) "`n`nlparam:`n" (_wparam(AThisFunc, lparam)) "`n" LHIGH "`n" LLOW "`n" LhexHIGH "`n" LhexLOW "`n" msg "`n" xhwnd
}
;;;;; ---- :::: ----
_wparam(AThisFunc, wparam) {
;if (AThisFunc="WM_LBUTTONUP") {
Return xwparam := (wParam=16) ? ("Die mittlere Maustaste ist unten!")
: (wParam=8) ? ("STRG-Down!")
: (wParam=4) ? ("Shift-Down!")
: (wParam=2) ? ("RMouse-Down!")
: ((isObject(wParam) ? "Object" : "0x" . Format("{:X}", wParam)))
}
;;;;; ---- :::: ----
WM_NCMOUSEHOVER(wparam, lparam, msg, hwnd) {
LLOW := ((lParam >> 16) & 0xFFFF)
LHIGH := (lParam & 0xFFFF)
LhexLOW := ("0x" . Format("{:X}", ((lParam >> 16) & 0xFFFF)))
LhexHIGH := ("0x" . Format("{:X}", (lParam & 0xFFFF)))
xhwnd := _wparam(AThisFunc, hwnd)
ToolTip,% "AThisFunc:`n" A_ThisFunc "`nwparam:`n" wparam "`n" (_wparam(AThisFunc, wparam)) "`n`nlparam:`n" (_wparam(AThisFunc, lparam)) "`n" LHIGH "`n" LLOW "`n" LhexHIGH "`n" LhexLOW "`n" msg "`n" xhwnd
}
;;;;; ---- :::: ----
WM_NCMOUSELEAVE(wparam, lparam, msg, hwnd) {
LLOW := ((lParam >> 16) & 0xFFFF)
LHIGH := (lParam & 0xFFFF)
LhexLOW := ("0x" . Format("{:X}", ((lParam >> 16) & 0xFFFF)))
LhexHIGH := ("0x" . Format("{:X}", (lParam & 0xFFFF)))
xhwnd := _wparam(AThisFunc, hwnd)
ToolTip,% "AThisFunc:`n" A_ThisFunc "`nwparam:`n" wparam "`n" (_wparam(AThisFunc, wparam)) "`n`nlparam:`n" (_wparam(AThisFunc, lparam)) "`n" LHIGH "`n" LLOW "`n" LhexHIGH "`n" LhexLOW "`n" msg "`n" xhwnd
}
;;;;; ---- :::: ----
WM_NCMOUSEMOVE(wparam, lparam, msg, hwnd) {
LLOW := ((lParam >> 16) & 0xFFFF)
LHIGH := (lParam & 0xFFFF)
LhexLOW := ("0x" . Format("{:X}", ((lParam >> 16) & 0xFFFF)))
LhexHIGH := ("0x" . Format("{:X}", (lParam & 0xFFFF)))
xhwnd := _wparam(AThisFunc, hwnd)
ToolTip,% "AThisFunc:`n" A_ThisFunc "`nwparam:`n" wparam "`n" (_wparam(AThisFunc, wparam)) "`n`nlparam:`n" (_wparam(AThisFunc, lparam)) "`n" LHIGH "`n" LLOW "`n" LhexHIGH "`n" LhexLOW "`n" msg "`n" xhwnd
}
;;;;; ---- :::: ---- analog clock anfang
ONCEONLY:
;; will last for duration of program
_xx := 0 ; x cord of canvas area
_yy := 0 ; y cord ""
_ww := 200 ; width ""
_hh := 200 ; height ""
gosub CreateStruc
gosub CreateBckBuffer
RETURN
Working:
;; NB: all colors in API are BGR tuples
;; popup if computer is idle > 10 minutes
IfGreater, A_TimeIdle, 600000
winactivate,AhkClock
;; Use a rectangle to clear the canvas (invisible colour!)
hBrush := DllCall("CreateSolidBrush", UInt,0x452301)
DllCall("SelectObject" ,UINT,memDC,uint,hBrush)
DllCall("FillRect", UInt, MemDC, Str, Rect, UInt, hBrush)
DllCall("DeleteObject", UInt, hBrush)
;-----
;; Draw 2 filled circles
;; 17 million to choose from and we always use white ? :)
hBrush := DllCall("CreateSolidBrush", UInt,bgr(255,255,255))
DllCall("SelectObject" ,UINT,memDC,uint,hBrush)
hCurrPen := DllCall("CreatePen" ,uint,0,uint,2,uint,bgr(0,0,0))
DllCall("SelectObject" ,UINT,memDC,uint,hCurrPen)
DllCall("Ellipse",uint,memdc,uint,3,uint,3,uint,197,uint,197)
DllCall("Ellipse",uint,memdc,uint,16,uint,16,uint,184,uint,184)
DllCall("DeleteObject", UInt, hBrush)
DllCall("DeleteObject", UInt, hCurrPen)
;; Draw some dots for the hour markers
dotpos = 0
loop 12
{
dotpos+=2pi/12
POSX := _ww/2 + 90*COS(dotpos)
POSY := _hh/2 + 90*SIN(dotpos)
hCurrPen := DllCall("CreatePen" ,uint,0,uint,8,uint,bgr(0,0,0))
DllCall("SelectObject" ,UINT,memDC,uint,hCurrPen)
DllCall("MoveToEx" ,UINT,memDC, UINT,POSX,UINT,POSY,UINT,0)
DllCall("LineTo" ,UINT,memDC,UINT,POSX,UINT,POSY)
DllCall("DeleteObject", UInt, hCurrPen)
}
;; Draw some minute markers
dotpos = 0
loop 60
{
dotpos+=2pi/60
POSX := _ww/2 + 88*COS(dotpos)
POSY := _hh/2 + 88*SIN(dotpos)
hCurrPen := DllCall("CreatePen" ,uint,0,uint,3,uint,bgr(0,0,0))
DllCall("SelectObject" ,UINT,memDC,uint,hCurrPen)
DllCall("MoveToEx" ,UINT,memDC, UINT,POSX,UINT,POSY,UINT,0)
DllCall("LineTo" ,UINT,memDC,UINT,POSX,UINT,POSY)
DllCall("DeleteObject", UInt, hCurrPen)
}
;;
;; HOUR HAND
HANDpos := 2pi*(((A_hour+A_min/60)*5)/60) ; creeps by minutes
hlen = 45
wide = 8
hcol := Bgr(255,150,0)
GOSUB DRAW_HAND
;;
;; MINUTE HAND
HANDpos := 2pi*((A_min/60)+(A_sec/3600)) ; creeps by seconds
HLEN = 65
WIDE = 6
HCOL := Bgr(0,255,0)
GOSUB DRAW_HAND
;; SECOND HAND
HANDpos := 2pi*(A_sec/60)
HLEN = 90
WIDE = 2
HCOL := Bgr(0,0,255)
GOSUB DRAW_HAND
;;
FormatTime, Mdate ,A_now,ddd dd MMM yy
DllCall("SetTextColor",UINT,MEMdc,UINT,0X0)
DllCall("SetBkMode",UINT,MEMdc,UINT,1) ; transparent
;; minimal font handling, I jest not - You'd better believe it !
hFont := DllCall("CreateFont",uint,14,uint,0,uint,0,uint,0 ,uint,700 ,uint,0
,uint,0 ,uint,0 ,uint,0 ,uint,0 , uint,0,uint,0 ,uint,0
, verdana)
DllCall("SelectObject" ,UINT,memDC,uint,hFont)
DllCall("TextOutA",UINT,MEMDC,UINT,70,UINT,130,STR,Mdate,UINT,13)
DllCall("TextOutA",UINT,MEMDC,UINT,70,UINT,50,STR,"AutoHotkey",UINT,10)
DllCall("DeleteObject", UInt, Hfont)
;; What! no clockface numbers !! Well, go on then, Experiment :)
gosub UpdateScreen
Return
;;#############################################################################
;; +++++++++++ END OF PROGRAM SECTION ++++++++++++++
;;#############################################################################
Bgr(_blu,_grn,_red)
{
return (_blu << 16 | _grn << 8 | _red)
}
DRAW_HAND:
POSX := _ww/2 + hlen*COS(HANDpos-2pi/4)
POSY := _hh/2 + hlen*SIN(HANDpos-2pi/4)
hCurrPen := DllCall("CreatePen" ,uint,0,uint,wide,uint,hcol)
DllCall("SelectObject" ,UINT,memDC,uint,hCurrPen)
DllCall("MoveToEx" ,UINT,memDC, UINT,_ww/2,UINT,_hh/2,UINT,0)
DllCall("LineTo" ,UINT,memDC,UINT,POSX,UINT,POSY)
DllCall("DeleteObject", UInt, hCurrPen)
RETURN
CreateStruc:
VarSetCapacity(Rect, 16, 0)
InsertInteger(0,rect,0) ; always zero
InsertInteger(0,rect,4) ; always zero
InsertInteger(_ww,rect,8)
InsertInteger(_hh,rect,12)
Return
CreateBckBuffer:
ScreenDC := DllCall("GetDC", uint,hwndA)
MemDC := DllCall("CreateCompatibleDC",uint,ScreenDC)
MemBM := DllCall("CreateCompatibleBitmap",uint,ScreenDC ,uint,_ww,uint,_hh)
DllCall("SelectObject",uint,MemDC,uint,MemBM)
Return
ReleaseGraphics:
DllCall("ReleaseDC", UInt, 0, UInt, ScreenDC)
DllCall("DeleteObject", UInt,MemDC)
DllCall("DeleteObject", UInt,MemBM)
Return
UpdateScreen:
DllCall("BitBlt"
,Uint,ScreenDC,uint,_xx,uint,_yy,uint,_ww,uint,_hh
,Uint,MemDC,uint,0,uint,0,Uint
,0x00CC0020) ;; Srccopy As Is
Return
InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; The caller must ensure that pDest has sufficient capacity.
; To preserve any existing contents in pDest,
; only pSize number of bytes starting at pOffset are altered in it.
{
Loop %pSize%
DllCall("RtlFillMemory", UInt, &pDest + pOffset + A_Index-1
, UInt, 1, UChar, pInteger >> 8*(A_Index-1) & 0xFF)
}
;;;;; ---- :::: ---- clock ende
;;;;; ---- :::: ----
CreateMenu(oMenu) {
for k, v in oMenu {
for i, v in v {
if !IsObject(v.label)
Menu, % k, Add, % v.text, % v.label
else
Menu, % k, Add, % v.text, % ":" CreateMenu(v.label)
if v.icon {
RegExMatch(v.icon, "(?<file>[^,]+)(,(?<num>.+))?", _)
Menu, % k, Icon, % v.text, % _file, % _num
}
}
}
Return k
}
;;;;; ---- :::: ----
; Ist es möglich, mit der rechten Maustaste auf die Registerkarten einer Listenansicht zu klicken?
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=83561
;OnMessage(0x0205, "WM_RBUTTONUP")
WM_RBUTTONUP(W, L, M, H) {
; WM_RBUTTONUP (0x0205) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, Right click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
TollerTipFunc("Right click on tab control on item " Item)
Return 0
}
}
;;;;; ---- :::: ----
;OnMessage(0x0208, "WM_MBUTTONUP")
WM_MBUTTONUP(W, L, M, H) {
; WM_MBUTTONUP (0x0208) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, M click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
TollerTipFunc("M click on tab control on item " Item)
Return 0
}
}
;;;;; ---- :::: ----
;OnMessage(0x0202, "WM_LBUTTONUP")
WM_LBUTTONUP(W, L, M, H) {
; WM_LBUTTONUP (0x0202) -> https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
; TCM_HITTEST (0x130D) -> https://docs.microsoft.com/en-us/windows/win32/controls/tcm-hittest
If (A_GuiControl = "TabName") {
VarSetCapacity(TCHTI, 12, 0) ; TCHITTESTINFO structure
NumPut(L << 48 >> 48, TCHTI, 0, "Int")
NumPut(L << 32 >> 48, TCHTI, 4, "Int")
Item := DllCall("SendMessage", "Ptr", H, "UInt", 0x130D, "Ptr", 0, "Ptr", &TCHTI, "Int") + 1
ToolTip, Left click on tab control on item %Item%
SetTimer, ToolTipOff, -2500
TollerTipFunc("Left click on tab control on item " Item)
Return 0
}
}
;;;;; ---- :::: ----
;;;;; ---- :::: ----
;;;;; ---- :::: ----
;;;;; ---- :::: ----
;;;;; ---- :::: ----
MainGuiClose:
ExitApp