Jump to content

Dragging window around doesn't work


Bert
 Share

Recommended Posts

I borrowed from another script of mine a method to drag a window around. If I add

Case $msg = $GUI_EVENT_PRIMARYDOWN 
Drag()

to the loop, the buttons stop working. I'm assuming the dll call is the problem, but how to fix it I do not know. I want to be able to drag the window around when needed.

#include <GuiConstants.au3>
#include <IE.au3>
Dim $s_html
_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
$gui = GuiCreate("Spellchecker", 450, 70,-1, -1 , $WS_POPUP, $WS_EX_TOOLWINDOW)
$GUIActiveX = GUICtrlCreateObj($oIE,5, 5, 330, 60)
$Button_1 = GuiCtrlCreateButton("Paste to Clipboard", 340, 10, 100, 20)
$Button_2 = GuiCtrlCreateButton("close", 340, 40, 40, 20)
_IENavigate ($oIE, "about:blank")
$s_html &= '<HTML>' & @CR
$s_html &= '<BODY>' & @CR
$s_html &= '<input type="text" size="40">' & @CR
$s_html &= '</HTML>' & @CR
$s_html &= '</BODY>' 
_IEDocWriteHTML($oIE, $s_html)
_IEAction($oIE, "refresh")
GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            $page = _IEbodyReadhtml($oIE)
            $trmLeft =StringTrimLeft($page, 21)
            $trimRight = StringTrimRight($trmLeft, 2)
            ClipPut($trimRight)
            _IEAction($oIE, "refresh")                  
        Case $msg = $Button_2
            ExitLoop
        Case $msg = $GUI_EVENT_PRIMARYDOWN;If this case statement is not commented out, the buttons do not work. Why??
            Drag()          
        Case Else
        ;;;
    EndSelect
WEnd
Exit

Func Drag()
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $gui, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)
EndFunc  ;==>Drag
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...