Jump to content

Recommended Posts

Posted

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 do

gui script.au3

mousehook script.au3

Posted

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

NEWHeader1.png

Posted

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.

Posted (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... :mellow:

Edited by ebvgfuabiv
Posted

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

Posted (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 by ebvgfuabiv
Posted (edited)

GUI_WS_EX_PARENTDRAG Ex Style will do magic for you :mellow:

#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 by monoscout999

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
×
×
  • Create New...