Sign in to follow this  
Followers 0
jennico

get a click on the titlebar ? how to

6 posts in this topic

#1 ·  Posted (edited)

how can i catch a (right) click on titlebar without a loop (no ispressed, no guigetcursorinfo) ?

guiregistermessage only reacts on clicks in the client area.

so please how can i do that ?

j.

edit: without guioneventmode, please.

and by the way: how can i catch a click on the sysmenu ?

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

how can i catch a (right) click on titlebar without a loop (no ispressed, no guigetcursorinfo) ?

guiregistermessage only reacts on clicks in the client area.

so please how can i do that ?

j.

edit: without guioneventmode, please.

and by the way: how can i catch a click on the sysmenu ?

@jennico

$WM_SYSCOMMAND

$WM_NCRBUTTONDOWN

onclick mouse event

http://www.autoitscript.com/forum/index.ph...lick+on+caption

there are examples on the forum of sysymenu editing

#include <GUIConstantsEX.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <MenuConstants.au3>
#include <GUIMenu.au3>

$hGui = GUICreate("Caption and SysMenu click capture", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
$hSysMenu = _GUICtrlMenu_GetSystemMenu($hGui); change/add/remove SysMenu items
$cCaptionDummy = GUICtrlCreateDummy()
$cSysMenuDummy = GUICtrlCreateDummy()

GUIRegisterMsg($WM_SYSCOMMAND, "_WM_HANDLER")
GUIRegisterMsg($WM_NCRBUTTONDOWN, "_WM_HANDLER")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cSysMenuDummy
            _Events(GUICtrlRead($cSysMenuDummy))
        Case $cCaptionDummy
            _Events(GUICtrlRead($cCaptionDummy))
    EndSwitch
WEnd

Func _Events($iEvent)
    ConsoleWrite($iEvent & @CRLF)
EndFunc ;==>_Events

Func _WM_HANDLER($hWnd, $msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    $wParam = Number($wParam)
;ConsoleWrite('-$wParam = ' & Hex($wParam) & @crlf)
    Switch $msg
        Case $WM_NCRBUTTONDOWN
            If $wParam = $HTCAPTION Then GUICtrlSendToDummy($cCaptionDummy, $wParam)
        Case $WM_SYSCOMMAND
            GUICtrlSendToDummy($cSysMenuDummy, $wParam)
            Switch $wParam
                Case $SC_RESTORE
                Case $SC_MOVE
                    Return 0
                Case $SC_SIZE
                    Return 0
                Case $SC_MINIMIZE
                Case $SC_MAXIMIZE
                Case $SC_CLOSE
            ;Return 0
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_HANDLER
Edited by rover

I see fascists...

Share this post


Link to post
Share on other sites

how can i catch a (right) click on titlebar without a loop (no ispressed, no guigetcursorinfo) ?

guiregistermessage only reacts on clicks in the client area.

so please how can i do that ?

j.

edit: without guioneventmode, please.

and by the way: how can i catch a click on the sysmenu ?

1

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 300, 200)

GUIRegisterMsg($WM_NCRBUTTONDOWN, "WM_NCRBUTTONDOWN")

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_NCRBUTTONDOWN($hWnd, $Msg, $wParam, $lParam)
    If $wParam = $HTCAPTION Then
        ConsoleWrite("Title was clicked" & @LF)
        Return 0
    EndIf
    
    Return $GUI_RUNDEFMSG
EndFuncoÝ÷ Ù½¿m«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíÕ¥5¹Ô¹ÔÌÐì()±½°¹Õ´ÀÌØí¥}UI0ôÄÀÀÀ°ÀÌØí¥}½ÕÐ((ÀÌØí¡Õ¤ôU%
ÉÑ ÅÕ½Ðí5¹ÔÑÍÐÅÕ½Ðì°ÌÀÀ°ÈÀÀ¤((ÀÌØí¡5¹Ôô}U%
Ñɱ5¹Õ}ÑMåÍѵ5¹Ô ÀÌØí¡Õ¤¤()}U%
Ñɱ5¹Õ}ÁÁ¹5¹Ô ÀÌØí¡5¹Ô°ÀÌØí5}MAIQ=H°À°À¤)}U%
Ñɱ5¹Õ}ÁÁ¹5¹Ô ÀÌØí¡5¹Ô°ÀÌØí5}MQI%9°ÀÌØí¥}UI0°ÅÕ½Ðí¼Ñ¼ÉÍ̸¸¸ÅÕ½Ðì¤)}U%
Ñɱ5¹Õ}ÁÁ¹5¹Ô ÀÌØí¡5¹Ô°ÀÌØí5}MQI%9°ÀÌØí¥}½ÕаÅÕ½Ðí½ÕÐÅÕ½Ðì¤()U%I¥ÍÑÉ5Í ÀÌØí]5}MeM
=559°ÅÕ½Ðí]5}MeM
=559ÅÕ½Ðì¤()U%MÑMÑÑ ¤()¼)U¹Ñ¥°U%Ñ5Í ¤ô´Ì()Õ¹]5}MeM
=559 ÀÌØí¡]¹°ÀÌØí5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤($ÀÌØí¥%ô  ¥Ñ9 ÀÌØíÝAÉ´°ÁàÀÀÀÁ¤($(%MÝ¥Ñ ÀÌØí¥%($%
ÍÀÌØíM
}
1=M($$%
½¹Í½±]É¥Ñ ÅÕ½Ðí
±½Íµ¹Ô¥Ñ´ÅÕ½ÐìµÀì1¤($%
ÍÀÌØíM
}5%9%5%i($$%
½¹Í½±]É¥Ñ ÅÕ½Ðí5¥¹¥µ¥éµ¹Ô¥Ñ´ÅÕ½ÐìµÀì1¤($%
ÍÀÌØíM
}5=Y($$%
½¹Í½±]É¥Ñ ÅÕ½Ðí5½Ùµ¹Ô¥Ñ´ÅÕ½ÐìµÀì1¤($%
ÍÀÌØí¥}UI0($$%M¡±±áÕÑ ÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹÕѽ¥ÑÍÉ¥Áй½´½½ÉÕ´ÅÕ½Ðì¤($%
ÍÀÌØí¥}½ÕÐ($$%5Í  ½à ØаÅÕ½Ðí½ÕÐÅÕ½Ðì°ÅÕ½ÐíÕѽ¥ÐØÅÕ½ÐìµÀìÕѽ%ÑYÉÍ¥½¸¤(%¹MÝ¥Ñ ($(%IÑÕɸÀÌØíU%}IU95M)¹Õ¹

:)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

yes thank you. for the title bar it's clear.

what i did not explain well, is a click on the caption menu.

GUICreate("")

GUICtrlCreateMenu("File")
GUICtrlCreateMenu("About")
GUICtrlCreateMenu("Help")

GUISetState()

While GUIGetMsg()<>-3
    Sleep(1)
WEnd

how would i get a click on "file", "about", "help" ?

WM_NCHITTEST , WM_NCLBUTTONDOWN : it would be helpful to get explained the abbreviation. what stands NC for ?

i would like to ask you not to use ConsoleWrite :). (this is no complaint, only a friendly hint) :)

thank you.

j.

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

jennico

what i did not explain well, is a click on the caption menu.

The second example which I posted is doesn't work?

how would i get a click on "file", "about", "help" ?

In the system menu? Or you mean the "ordinary" menu? Please explain what exactly you want.

WM_NCHITTEST , WM_NCLBUTTONDOWN : it would be helpful to get explained the abbreviation. what stands NC for ?

MSDN

i would like to ask you not to use ConsoleWrite

Use the MsgBox function.

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