ebvgfuabiv Posted September 3, 2011 Share Posted September 3, 2011 i need to be able to drag a window with out a border. So far i was able to drag the window but it only would move inverted can someone please help me make this not move inverted. it need two scripts to work. Run the MouseHook Script.au3 1th then the GUI Script.au3. tho if you can combine or simplify the 2 scripts that would help alot too. you will need a pic named window.bmp any pic will dogui script.au3mousehook script.au3 Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2011 Share Posted September 3, 2011 This might help... #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $Gui = GuiCreate("Test", 200, 100, -1, -1, $WS_POPUP, $WS_EX_DLGMODALFRAME) GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit EndSwitch WEnd Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc Valuater Link to comment Share on other sites More sharing options...
ebvgfuabiv Posted September 3, 2011 Author Share Posted September 3, 2011 Valuaterthis this is definitely better then the mousehook script i was using. But is there a way to make it only show in Image and then you can move the Image with your mouse. Link to comment Share on other sites More sharing options...
ebvgfuabiv Posted September 3, 2011 Author Share Posted September 3, 2011 (edited) I tried doing this but now it won't move... #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $Gui = GuiCreate("Test", 808, 691, -1, -1,$WS_POPUP,$WS_EX_LAYERED) guisetbkcolor(0x000000) guictrlcreatepic("window.bmp",-1,-1,808,691) GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit EndSwitch WEnd Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc sorry kind of new to au3 scripting... Edited September 3, 2011 by ebvgfuabiv Link to comment Share on other sites More sharing options...
ebvgfuabiv Posted September 3, 2011 Author Share Posted September 3, 2011 got it to work with this. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("window",808, 691, -1, -1,$WS_POPUP,$WS_EX_LAYERED) GUICtrlCreatePic("window.bmp",-1,-1,808,691) guisetbkcolor(0x808000) GUICtrlSetState (-1,$GUI_DISABLE) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() While 1 wend Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) Local $iProc $iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) $iProc = $iProc[0] If $iProc = $HTCLIENT Then Return $HTCAPTION Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
ebvgfuabiv Posted September 3, 2011 Author Share Posted September 3, 2011 (edited) Now all i need is instead of being able to drag the window by clicking any area to only being able to drag the window in a specific area any ideas on how i can do this? keep in mind that the window has to be border-less and displaying only a image. never mind i got it work thank you Valuaterthis for the help Edited September 3, 2011 by ebvgfuabiv Link to comment Share on other sites More sharing options...
monoscout999 Posted September 4, 2011 Share Posted September 4, 2011 (edited) GUI_WS_EX_PARENTDRAG Ex Style will do magic for you #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $image = @ScriptDir & "\test.jpg" If Not FileExists($image) Then InetGet("http://i273.photobucket.com/albums/jj239/StarcraftImages/MCR.jpg", $image) $MainGui = GUICreate("Test", 600, 400, -1, -1, $WS_POPUP) GUICtrlCreatePic($image, 0, 0, 600, 400) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Drag Me", 10, 10, 150, 150, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Edited September 4, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now