Jump to content

Anyone know the combination?


kjactive
 Share

Recommended Posts

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

Const $HTCAPTION = 2
Const $WM_NCLBUTTONDOWN = 0xA1

$gui = GuiCreate("Title",300,200,-1,-1,$WS_SIZEBOX);,BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetOnEvent ($GUI_EVENT_CLOSE, "Quit" )
GUISetOnEvent ($GUI_EVENT_PRIMARYDOWN, "Drag" )
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Drag()
    dllcall("user32.dll","int","ReleaseCapture")
    dllcall("user32.dll","int","SendMessage","hWnd", $gui,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
EndFunc

Func Quit()
    Exit
EndFunc

EDIT:

without titlebar use:

$gui = GuiCreate("Title",300,200,-1,-1,BitOR($WS_POPUP,$WS_BORDER,$WS_SIZEBOX))
Edited by Zedna
Link to comment
Share on other sites

Neat trick, Zedna :)

Although if that window is going to have any controls that require mouse interaction (buttons, sliders and such), you'd have to change Drag() function to something like this:

Func Drag()
    $a = GUIGetCursorInfo($gui)
    If $a[4] = 0 Then ;or exclude specific controlIDs
        dllcall("user32.dll","int","ReleaseCapture")
        dllcall("user32.dll","int","SendMessage","hWnd", $gui,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
    EndIf
EndFuncoÝ÷ ÚìjeÉ«­¢+ÙÕ¹É ¤(%±±±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíM¹5ÍÍÅÕ½Ðì°ÅÕ½Ðí¡]¹ÅÕ½Ðì°ÀÌØíÕ¤°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí]5}9
1   UQQ=9=]8°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí!Q
AQ%=8°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤)¹Õ¹

Otherwise those controls wouldn't work.

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Neat trick, Zedna :)

Although if that window is going to have any controls that require mouse interaction (buttons, sliders and such), you'd have to change Drag() function to something like this:

Otherwise those controls wouldn't work.

I know about this limitation.

Your workaround is nice ;-)

Link to comment
Share on other sites

  • 3 weeks later...

In testing, I noticed something between beta and production AutoIt versions:

3.2.8.1 will run the script with no errors

Beta (3.2.9.3) gives a error:

(6,31) : ERROR: $WM_NCLBUTTONDOWN previously declared as a 'Const'
Const $WM_NCLBUTTONDOWN = 0xA1

I can comment the line out, and it will run no problem.

The only thing I can think of is GUIConstants may have been changed. No biggy here for the fix is simple. Just something I found.

Link to comment
Share on other sites

  • Moderators

In testing, I noticed something between beta and production AutoIt versions:

3.2.8.1 will run the script with no errors

Beta (3.2.9.3) gives a error:

(6,31) : ERROR: $WM_NCLBUTTONDOWN previously declared as a 'Const'
Const $WM_NCLBUTTONDOWN = 0xA1

I can comment the line out, and it will run no problem.

The only thing I can think of is GUIConstants may have been changed. No biggy here for the fix is simple. Just something I found.

I'm sure Gary added this when he added his trunk full of GUI functions.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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