Jump to content

Recommended Posts

Posted (edited)

Do you guys have any idea on how to turn this function to move current active window instead of the GUI?

I have been trying for a while without going anywhere seems like I always have to specify the title or text of the window, i would like autoit to detect current active and enable dragging ...

#include <GuiconstantsEx.au3>
 #include <WindowsConstants.au3>
 #include <SendMessage.au3>

 HotKeySet("{ESC}", "On_Exit")

 $hGUI = GUICreate("X", 100, 100, -1, -1, $WS_POPUP)
 GUISetBkColor(0x00FF00, $hGUI)
 $hButton = GUICtrlCreateButton("Test", 10, 35, 80, 30)
 GUISetState()

 While 1
     Switch GUIGetMsg()
         Case $GUI_EVENT_PRIMARYDOWN
             On_Drag()
         Case $hButton
             On_Button()
     EndSwitch
 WEnd

 Func On_Drag()
     Local $aCurInfo = GUIGetCursorInfo($hGUI)
     If $aCurInfo[4] = 0 Then ; Mouse not over a control
         DllCall("user32.dll", "int", "ReleaseCapture")
         _SendMessage($hGUI, $WM_NCLBUTTONDOWN, $HTCAPTION, 0)
     EndIf
 EndFunc   ;==>On_Drag

 Func On_Exit()
     Exit
 EndFunc   ;==>On_Exit

 Func On_Button()
      MsgBox(0, "Hi", "Button Pressed")
 EndFunc   ;==>On_Button

 

Edited by Jos
  • Developers
Posted (edited)

So this is the Third topic you post in the wrong Forum, and you got a WARNING the previous time, so which part is difficult for you to understand?
Secondly: What is different in this topic from your previous two?

 

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

  Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Expand  

Moderation Team

 

@Everybody else: Please stay out for now!

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Hey Jos, apologies for that will post in *Developer General Discussion* from now on

 

So basically I managed to move drag window but I am using a 2k and 4k monitor so when dragging from one monitor to the other I have a wierd glitch that causes resizing 

with that code windows thinks that active window has been moved from title bar and by disabling in performace the animation, when dragging is displayed as a rectangle, I don't get anymore the dragging animation but the glitch is gone, so I was thinking to go with this option here. Just need to find a way to apply this to current active window and should do the trick!

Edited by Palkiao
  • Developers
Posted (edited)
  On 1/28/2022 at 9:28 AM, Palkiao said:

Hey Jos, apologies for that will post in *Developer General Discussion* from now on

Expand  

Please read that standard post again and then from here on NOT post in Developer General Forum anymore but rather where we are now:

AutoIt General Help and Support

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...