Window move glitch

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Window move glitch

21 Sep 2021, 16:18

I have encountered a bit of glitch that seems to happen (Start happening) randomly and without cause.

Normally if I click on one of the windows I can see the window move along with my mouse, but then for no reason I have been able to work out yet it bugs out and it no longer shows the window moving with the mouse. It just appears when you release it.


Here one window is glitched and the other is normal.

Temp (1).gif
Temp (1).gif (319.96 KiB) Viewed 273 times


This is the section of code that deals with windows messages, including moving the window.

Code: Select all

_CreateMainWindow( obj := "" ){
		
		This.W := This.ScreenClip.Width + 20
		This.Overlay.Height := This.H := This.ScreenClip.Height + 20
		
		This.Gui1 := New PopUpWindow( { WindowName: "Main_" ScreenClipOrDraw.Index , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: ( obj.Haskey( "x" ) ) ? ( obj.x ) : ( "Center" ) , Y: ( obj.Haskey( "y" ) ) ? ( obj.y ) : ( "Center" ) , W: This.W , H: This.H } )
		This.Gui1.ShowWindow()
		
		OnMessage( 0x200 , This._OnMove.Bind( This ) )
		OnMessage( 0x201 , This._OnClick.Bind( This ) )
		OnMessage( 0x202 , This._OnClickUp.Bind( This ) )
		
		This.inhibit_movesize_loop := true
		WM_CAPTURECHANGED := 0x0215, WM_WINDOWPOSCHANGING := 0x0046
		OnMessage(WM_CAPTURECHANGED, This.MessageHandler.Bind( This ) )
		OnMessage(WM_WINDOWPOSCHANGING, This.MessageHandler.Bind( This ) )
		
	}
	_OnMove(){
		local x, y
		MouseGetPos,x,y
		if( x > This.W - 50 && !This.OverLay.Active && WinActive() = This.Gui1.Hwnd  && !This.Moving ){
			This._DrawOverlay()
			This.OverLay.Active := 1
		}else if( This.OverLay.Active && x < This.W - 50 ){
			This.OverLay.Active := 0
			This._HideOverlay()
		}
	}
	_OnClick(){
		local x, y, win
		CoordMode, Mouse, Client
		MouseGetPos, x, y, win
		
		if( win = This.Gui2.Hwnd ){
			
			if( y < This.Gui2.H / 2 ){
				This._Destroy()
			}else{
				if( This.ToolWIndowActive := !This.ToolWIndowActive )
					This._ActivateToolWindow()
				else
					This._HideToolWindow()
			}
		}else if( win = This.Gui1.Hwnd ){
			This._HideOverlay()
			Postmessage, 0xA1, 2
			This.Moving := 1
			While( GetKeyState( "LButton" ) )
				Sleep, 30
			This.Moving := 0
			
		}
	}
	_OnClickUp(){
		;~ ToolTip, In Click Up
		;~ SoundBeep, 999
	}
	MessageHandler(wParam, lParam, msg, hwnd) {
		local WM_CAPTURECHANGED := 0x0215, WM_WINDOWPOSCHANGING := 0x0046 ;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=91862&p=406372#p406394
		if (hwnd = This.Gui1.Hwnd ) {
			Switch msg {
				Case WM_CAPTURECHANGED: This.inhibit_movesize_loop := !This.inhibit_movesize_loop
				Case WM_WINDOWPOSCHANGING:
					if This.inhibit_movesize_loop {
						flags := NumGet(lParam + A_PtrSize*2 + 16, "UInt")
						NumPut(flags | 0x0002, lParam + A_PtrSize*2 + 16, "UInt") 
					}
			}
		}
	}
And here is the working code.

Code: Select all


;******
#Include <My Altered GDIP lib> ;Requires GDIP By Tic
;******


;#Include <PopUpWindow Class> ;Added to the bottom of the script

DetectHiddenWindows, On
#SingleInstance, Force
SetBatchlines, -1

return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

NumPad3::PopUpWindow.Helper()
															;Path to a image file for testing
Numpad1::New ScreenClipOrDraw( Gdip_CreateBitmapFromFile( "C:\Users\Hellbent\Desktop\AHK Tools\Color Picker Mini\Screen Shots\20210921164832.png" ) )

;******************************************************************************************************************************************************************************
;******************************************************************************************************************************************************************************
;******************************************************************************************************************************************************************************
Class ScreenClipOrDraw	{
	static Index := 0 , Windows := [] , Handles := [] , pToken := GDIP_StartUp()
	__New( pBitmap , obj := "" ){
		This._SetDefaults()
		This._SetScreenClipBitmaps( pBitmap )
		This._CreateMainWindow( obj )
		This._DrawCliplayerOnly()
		This._CreateMainOverlay()
		This._CreateToolWindow()
	}
	_SetDefaults(){
		local cc 
		ScreenClipOrDraw.Index++
		
		This.Moving := 0
		
		This.X := 0
		This.Y := 0
		This.W := 0
		This.H := 0
		
		This.Overlay := {}
		This.Overlay.Width := 30
		This.Overlay.Height := ""
		This.Overlay.X := ""
		This.Overlay.Y := ""
		This.Overlay.Active := 0
		
		This.ScreenClip := {}
		This.ScreenClip.pBitmap := ""
		This.ScreenClip.Width := ""
		This.ScreenClip.Height := ""
		This.ScreenClip.X := 10
		This.ScreenClip.Y := 10
		
		
		
		This.DrawLayer := {}
		This.DrawLayer.pBitmap := ""
		This.DrawLayer.Width := ""
		This.DrawLayer.Height := ""
		This.DrawLayer.G := ""
		This.DrawLayer.Smoothing := ""
		This.DrawLayer.X := 10
		This.DrawLayer.Y := 10
	
	
	
		This.ToolWIndowActive := 0
	
		This.ToolWindow := {}
		This.ToolWindow.X := 0
		This.ToolWindow.Y := 0
		This.ToolWindow.W := 0
		This.ToolWindow.H := 0
		
		
		cc := This.ToolWindowButtons := []
		cc[1] := {}
		cc[1].pBitmap := ""
		cc[1].X := ""
		cc[1].Y := ""
		cc[1].W := ""
		cc[1].H := ""
		cc[1].Tog := ""
		
	}
	_HideToolWindow(){
		This.Gui3.HideWindow()
	}
	_ActivateToolWindow(){
		This._GetMainPosition()
		This.Gui3.X := This.Gui1.X + This.Gui1.W + 5
		This.Gui3.Y := This.Gui1.Y
		
		This.Gui3.DrawBitmap( TextButton() , { X: 0 , Y: 0 , W: 50 , H: 50 } , dispose := 1 )
		This.Gui3.DrawBitmap( ShapesButton() , { X: 0 , Y: 50 , W: 50 , H: 50 } , dispose := 1 )
		This.Gui3.UpdateWindow()
		This.Gui3.ShowWindow()
		
		
		
	}
	_SetScreenClipBitmaps( pBitmap ){
		This.ScreenClip.pBitmap := pBitmap
		This.DrawLayer.Width 	:= This.ScreenClip.Width 	:= Gdip_GetImageWidth( This.ScreenClip.pBitmap )
		This.DrawLayer.Height 	:= This.ScreenClip.Height 	:= Gdip_GetImageHeight( This.ScreenClip.pBitmap )
		This.DrawLayer.pBitmap 	:= Gdip_CreateBitmap( This.DrawLayer.Width , This.DrawLayer.Height )
		This.DrawLayer.G 		:= Gdip_GraphicsFromImage( This.DrawLayer.pBitmap ) 
		This.DrawLayer.Smoothing := 2 
		Gdip_SetSmoothingMode( This.DrawLayer.G , This.DrawLayer.Smoothing )
		
	}
	_CreateMainOverlay(){
		This.Gui2 := New PopUpWindow( { WindowName: "Overlay_" ScreenClipOrDraw.Index , WindowOptions: " -DPIScale +AlwaysOnTop +OwnerMain_" ScreenClipOrDraw.Index , WindowSmoothing: 2 , X: "Center" , Y: "Center" , W: 30 , H: This.Overlay.Height } )
	}
	_CreateToolWindow(){
		This.Gui3 := New PopUpWindow( { WindowName: "ToolWindow_" ScreenClipOrDraw.Index , WindowOptions: " -DPIScale +AlwaysOnTop +OwnerMain_" ScreenClipOrDraw.Index , WindowSmoothing: 2 , X: "Center" , Y: "Center" , W: 100 , H: 100 } )
	}
	_CreateMainWindow( obj := "" ){
		
		This.W := This.ScreenClip.Width + 20
		This.Overlay.Height := This.H := This.ScreenClip.Height + 20
		
		This.Gui1 := New PopUpWindow( { WindowName: "Main_" ScreenClipOrDraw.Index , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: ( obj.Haskey( "x" ) ) ? ( obj.x ) : ( "Center" ) , Y: ( obj.Haskey( "y" ) ) ? ( obj.y ) : ( "Center" ) , W: This.W , H: This.H } )
		This.Gui1.ShowWindow()
		
		OnMessage( 0x200 , This._OnMove.Bind( This ) )
		OnMessage( 0x201 , This._OnClick.Bind( This ) )
		OnMessage( 0x202 , This._OnClickUp.Bind( This ) )
		
		This.inhibit_movesize_loop := true
		WM_CAPTURECHANGED := 0x0215, WM_WINDOWPOSCHANGING := 0x0046
		OnMessage(WM_CAPTURECHANGED, This.MessageHandler.Bind( This ) )
		OnMessage(WM_WINDOWPOSCHANGING, This.MessageHandler.Bind( This ) )
		
	}
	_OnMove(){ 
		local x, y
		MouseGetPos,x,y
		if( x > This.W - 50 && !This.OverLay.Active && WinActive() = This.Gui1.Hwnd  && !This.Moving ){
			This._DrawOverlay()
			This.OverLay.Active := 1
		}else if( This.OverLay.Active && x < This.W - 50 ){
			This.OverLay.Active := 0
			This._HideOverlay()
		}
	}
	_OnClick(){
		local x, y, win
		CoordMode, Mouse, Client
		MouseGetPos, x, y, win
		
		if( win = This.Gui2.Hwnd ){
			
			if( y < This.Gui2.H / 2 ){
				This._Destroy()
			}else{
				if( This.ToolWIndowActive := !This.ToolWIndowActive )
					This._ActivateToolWindow()
				else
					This._HideToolWindow()
			}
		}else if( win = This.Gui1.Hwnd ){
			This._HideOverlay()
			Postmessage, 0xA1, 2
			This.Moving := 1
			While( GetKeyState( "LButton" ) )
				Sleep, 30
			This.Moving := 0
			
		}
	}
	_OnClickUp(){
		;~ ToolTip, In Click Up
		;~ SoundBeep, 999
	}
	MessageHandler(wParam, lParam, msg, hwnd) {
		local WM_CAPTURECHANGED := 0x0215, WM_WINDOWPOSCHANGING := 0x0046 ;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=91862&p=406372#p406394
		if (hwnd = This.Gui1.Hwnd ) {
			Switch msg {
				Case WM_CAPTURECHANGED: This.inhibit_movesize_loop := !This.inhibit_movesize_loop
				Case WM_WINDOWPOSCHANGING:
					if This.inhibit_movesize_loop {
						flags := NumGet(lParam + A_PtrSize*2 + 16, "UInt")
						NumPut(flags | 0x0002, lParam + A_PtrSize*2 + 16, "UInt") 
					}
			}
		}
	}
	_DrawOverlay(){
		This.Gui2.ClearWindow()
		This._GetMainPosition()
		This.Gui2.SetWindowProperties( { X: This.Gui1.X + This.W - 40  , Y: This.Gui1.Y } )
		This.Gui2.DrawBitmap( CloseButton() , { X: 0 , Y: 10 , W: 30 , H: 30 } , 1 )
		This.Gui2.DrawBitmap( OpenToolWindowButton() , { X: 0 , Y: This.Overlay.Height - 40 , W: 30 , H: 30 } , 1 )
		This.Gui2.UpdateWindow()
		This.Gui2.ShowWindow()
	}
	_HideOverlay(){
		This.Gui2.HideWindow()
	}
	_GetMainPosition(){
		local x, y
		WinGetPos, x, y ,,, % "AHK_ID " This.Gui1.Hwnd
		This.Gui1.X := x
		This.Gui1.Y := y
	}
	_DrawCliplayerOnly(){
		This.Gui1.ClearWindow()
		This.Gui1.PaintBackground( color := "0x8800FF00" )
		This.Gui1.DrawBitmap( This.ScreenClip.pBitmap , { X: 10 , Y: 10 , W: This.ScreenClip.Width , H: This.ScreenClip.Height } , 0 )
		This.Gui1.UpdateWindow()
	}
	_Destroy(){
		This.Gui1.DeleteWindow()
		This.Gui2.DeleteWindow()
		This.Gui3.DeleteWindow()
		This.Gui4.DeleteWindow()
		Gdip_DisposeImage( This.ScreenClip.pBitmap )
		Gdip_DeleteGraphics( This.DrawLayer.G )
		Gdip_DisposeImage( This.DrawLayer.pBitmap )
		For, k, v in This
			This[k] := ""
	}
}


;~ This.MainGui := New PopUpWindow( { WindowName: "1" , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: "Center" , Y: "Center" , W: 100 , H: 100 } )
		





TextButton(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 50 , 50 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_BrushCreateSolid( "0xFF3A4657" ) , Gdip_FillRectangle( G , Brush , -1 , -1 , 52 , 52 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_FillRectangle( G , Brush , 1 , 1 , 48 , 48 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRectangle( G , Brush , 2 , 2 , 46 , 46 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF396EA5" ) , Gdip_FillRectangle( G , Brush , 4 , 4 , 42 , 42 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "T" , "s46 Center vCenter Bold c" Brush " x1 y13" , "sitka small" , 48 , 48 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "T" , "s46 Center vCenter Bold c" Brush " x3 y15" , "sitka small" , 48 , 48 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF797979" ) , Gdip_TextToGraphics( G , "T" , "s46 Center vCenter Bold c" Brush " x2 y14" , "sitka small" , 48 , 48 ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
ShapesButton(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 50 , 50 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_BrushCreateSolid( "0xFF3A4657" ) , Gdip_FillRectangle( G , Brush , -1 , -1 , 52 , 52 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_FillRectangle( G , Brush , 1 , 1 , 48 , 48 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRectangle( G , Brush , 2 , 2 , 46 , 46 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF396EA5" ) , Gdip_FillRectangle( G , Brush , 4 , 4 , 42 , 42 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_FillRectangle( G , Brush , 10 , 10 , 25 , 25 ) , Gdip_DeleteBrush( Brush )
	Pen := Gdip_CreatePen( "0xFFF0F0F0" , 2 ) , Gdip_DrawRectangle( G , Pen , 9 , 10 , 25 , 25 ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillEllipse( G , Brush , 17 , 17 , 25 , 25 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 17 , 17 , 25 , 25 , "0xcc0000ff" , "0xcc000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 17 , 17 , 25 , 25 ) , Gdip_DeletePen( Pen )
	Gdip_DeleteGraphics( G )
	return pBitmap
}

CloseButton(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 30 , 30 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_CreateLineBrushFromRect( 2 , 3 , 24 , 8 , "0xFFff0000" , "0xFF000000" , 3 , 2 ) , Gdip_FillEllipse( G , Brush , 2 , 2 , 26 , 26 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( -1 , 0 , 30 , 29 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 2 , 2 , 26 , 26 ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrush( 9 , 9 , 19 , 19 , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Gdip_TextToGraphics( G , "r" , "s16 Center vCenter Bold c" Brush " x3 y3" , "Webdings" , 26 , 26 ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
OpenToolWindowButton(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 30 , 30 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_CreateLineBrushFromRect( 2 , 3 , 24 , 8 , "0xFFffFF00" , "0xFF000000" , 3 , 2 ) , Gdip_FillEllipse( G , Brush , 2 , 2 , 26 , 26 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( -1 , 0 , 30 , 29 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 2 , 2 , 26 , 26 ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrush( 9 , 9 , 19 , 19 , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Gdip_TextToGraphics( G , "4" , "s24 Center vCenter Bold c" Brush " x4 y6" , "Webdings" , 26 , 26 ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}




;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
class PopUpWindow	{
	;Class By: Hellbent
	;Apr 2021
	static Index := 0 , Windows := [] , Handles := [] , HelpHandles := [] , HelperEditHwnd
	__New( obj := "" ){
		This._SetDefaults()
		if( isObject( obj ) )
			This.SetWindowProperties( obj )
		This._SetupWindowGraphics()
	}
	_SetDefaults(){
		PopUpWindow.Index++
		This.WindowName := "HBLayeredWindow" PopUpWindow.Index
		This.WindowSmoothing := 2
		This.WindowOptions := " -DPIScale +AlwaysOnTop "
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
	}
	PaintBackground( color := "0xFF000000" ){
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		Gdip_DeleteBrush( Brush )
	}
	_SetupWindowGraphics(){
		This.Hwnd := This._CreateGUI()
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.WindowSmoothing )
		PopUpWindow.Handles[ This.Hwnd ] := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
	}
	SetWindowProperties( obj , updateG := 0 ){
		local k , v 
		for k , v in obj
			if( k != "hwnd" )
				This[k] := v
			
			
		if(updateG){	
			SelectObject( This.hdc , This.obm )
			DeleteObject( This.hbm )
			DeleteDC( This.hdc )
			
			This.hbm := CreateDIBSection( This.W , This.H )
			This.hdc := CreateCompatibleDC()
			This.obm := SelectObject( This.hdc , This.hbm )
			This.G := Gdip_GraphicsFromHDC( This.hdc )
			Gdip_SetSmoothingMode( This.G , This.WindowSmoothing )	
		}
		( This.X = "center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 )
		( This.Y = "center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 )
	}
	ShowWindow( Title := "" ){
		Gui , % This.WindowName ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.WindowName ":Hide",
	}
	UpdateWindow(){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
	}
	ClearWindow(){
		Gdip_GraphicsClear( This.G )
	}
	DrawBitmap( pBitmap , obj , dispose := 1 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DeleteWindow(){
		Gui, % This.WindowName ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
	}
	_CreateGUI(){
		local hwnd
		Gui , % This.WindowName ":New" , % " +E0x80000 hwndhwnd -Caption  " This.WindowOptions
		return hwnd
	}
	Helper(){
		local List := ["New Window","SetWindowProperties","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow"]
		local hwnd, bd
		
		
		Gui, HBLWHelperGui:New, +AlwaysOnTop 
		Gui, HBLWHelperGui:Color, 62666a, 24282c
		Gui, HBLWHelperGui:Font, cWhite s10 , Segoe UI
		Gui, HBLWHelperGui:Margin, 5 , 5
		
		Gui, HBLWHelperGui:Add, Edit, xm ym w200 r1 Center hwndHwnd, Gui1
		PopUpWindow.HelperEditHwnd := Hwnd
		Gui, HBLWHelperGui:Margin, 5 , 1
		Loop, % List.Length()	{
		
			Gui, HBLWHelperGui:Add, Button, xm wp h23 -Theme hwndhwnd, % List[ A_Index ]
			PopUpWindow.HelpHandles[hwnd] := List[ A_Index ]
			bd := PopUpWindow._ClipIt.Bind( PopUpWindow )
			GuiControl , HBLWHelperGui: +G , % Hwnd , % bd
		}
		
		Gui, HBLWHelperGui:Show, 
		
	}
	_ClipIt(){
		local List := ["New Window","SetWindowProperties","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow"]
		local Output , FQ := 400
		GuiControlGet, Output , HBLWHelperGui: , % PopUpWindow.HelperEditHwnd
		Switch A_GuiControl
		{
			case List[1]:
				Clipboard := Output " := New PopUpWindow( { WindowName: ""1"" , WindowOptions: "" -DPIScale +AlwaysOnTop "" , WindowSmoothing: 2 , X: ""Center"" , Y: ""Center"" , W: 100 , H: 100 } )"
				loop 2
					SoundBeep, FQ
				return
			case List[2]:
				Clipboard := Output ".SetWindowProperties( { X: """" , Y: """" , W: """" , H: """" } )"
				loop 2
					SoundBeep, FQ
				return
			case List[3]:
				Clipboard := Output ".ShowWindow( MyWindowTitle := """" )"
				loop 2
					SoundBeep, FQ
				return
			case List[4]:
				Clipboard := Output ".HideWindow()"
				loop 2
					SoundBeep, FQ
				return
			case List[5]:
				Clipboard := Output ".UpdateWindow()"
				loop 2
					SoundBeep, FQ
				return
			case List[6]:
				Clipboard := Output ".ClearWindow()"
				loop 2
					SoundBeep, FQ
				return
			case List[7]:
				Clipboard := Output ".DrawBitmap( pBitmap := """" , { X: """" , Y: """" , W: """" , H: """" } , dispose := 1 )"
				loop 2
					SoundBeep, FQ
				return
			case List[8]:
				Clipboard := Output ".PaintBackground( color := ""0xFF000000"" )"
				loop 2
					SoundBeep, FQ
				return
			case List[9]:
				Clipboard := Output ".DeleteWindow()"
				loop 2
					SoundBeep, FQ
				return
			Default:
				ToolTip, Looks like a new case needs to be added
				return
			
		}
	}
}
Let me know if you have questions about anything, or have seen this before.

Thanks.
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Window move glitch

22 Sep 2021, 10:13

So, this is unrelated to the Windows' Performance Option setting?
Performance Options.png
Performance Options.png (29.9 KiB) Viewed 223 times
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Window move glitch

22 Sep 2021, 10:26

TheDewd wrote:
22 Sep 2021, 10:13
So, this is unrelated to the Windows' Performance Option setting?
That is the setting I use. When I drag a window around, I can see it moving with my cursor.

The bug is that windows in the script randomly ( I can't see a pattern )
lose the ability to be shown while they move.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mmflume, ShatterCoder and 116 guests