Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2025 in Posts

  1. That is fantastic. Very efficient. By the way, this is all really quite genius. What a coincidence, I was actually reading this same thread earlier in the morning. Sometimes I spend a good amount of time reading older threads here in the forum because it's literally a gold mine worth of information. Anyways, your technique is working. I've got it working with WS_EX_COMPOSITE and a perfectly working ListView thanks to the MDI GUI trick. I'll post the screenshot and more details in another comment because I just ran out of quota again...
    1 point
  2. @WildByDesign great result with the listview inside the MDI window So $WS_EX_COMPOSITED is now applied to the GUI (less flicker when resizing the GUI) and doesn't interfere with the "$LVS_EX_DOUBLEBUFFER listview" which is a control of an external MDI window, bravo !
    1 point
  3. Here is a quick addition of the ListView with LVS_EX_DOUBLEBUFFER. By the way, @pixelsearch, I see that you just edited your example. My ListView addition is based on your example that was originally posted. I still have to check your updated example. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> ; DPI DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Global $g_hGUI, $g_hChild, $g_hChildMDI, $g_aPosChild, $g_iDeltaX, $g_iDeltaY Example() Func Example() $g_hGUI = GUICreate("Example", 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED) GUISetBkColor(0x202020) GUISetState(@SW_SHOW, $g_hGUI) $g_hChild = GUICreate("ChildWindow", 320, 320, 40, 40, 0x40000000, -1, $g_hGUI) GUISetBkColor(0x606060) GUISetState(@SW_SHOW, $g_hChild) $g_hChildMDI = GUICreate("", 280, 280, 20, 20, $WS_POPUP, BitOr($WS_EX_MDICHILD, $WS_EX_CONTROLPARENT), $g_hChild) GUISetBkColor(0xff00ff) ; add listview Local $idListview = GUICtrlCreateListView("Column1|Column2", 20, 20, 240, 240, -1, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) Local $idLVi_Item1 = GUICtrlCreateListViewItem("1|1", $idListview) Local $idLVi_Item2 = GUICtrlCreateListViewItem("2|2", $idListview) Local $idLVi_Item3 = GUICtrlCreateListViewItem("3|3", $idListview) ; get rid of selection rectangle on listview GUICtrlSendMsg($idListview, $WM_CHANGEUISTATE, 65537, 0) GUISetState(@SW_SHOW, $g_hChildMDI) _CalcPosAndDelta() GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_MOVE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($g_hChildMDI) GUIDelete($g_hChild) GUIDelete($g_hGUI) EndFunc ;==>Example Func _CalcPosAndDelta() Local $aPosChildMDI = WinGetPos($g_hChildMDI) $g_aPosChild = WinGetPos($g_hChild) $g_iDeltaX = $g_aPosChild[0] - $aPosChildMDI[0] $g_iDeltaY = $g_aPosChild[1] - $aPosChildMDI[1] EndFunc ;==>_CalcPosAndDelta Func WM_ENTERSIZEMOVE($hWnd, $iMsg, $wParam, $lParam) _CalcPosAndDelta() EndFunc ;==>WM_ENTERSIZEMOVE Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $g_hGUI Then $g_aPosChild = WinGetPos($g_hChild) WinMove($g_hChildMDI, "", $g_aPosChild[0] - $g_iDeltaX, $g_aPosChild[1] - $g_iDeltaY) EndIf EndFunc ;==>WM_SIZE
    1 point
  4. I tried it like this, in the following script. Please note that you can move separately the pink MDI window by dragging it with the mouse (I applied to it the "AutoIt special" Exstyle $WS_EX_CONTROLPARENT) In this script, we don't need (for now) 2 separate functions WM_EXITSIZEMOVE() and WM_MOVE() as their content would duplicate the code found in functions WM_ENTERSIZEMOVE() and WM_SIZE() . This could change in case you'll have to work later on separate functions WM_SIZE() and WM_MOVE() #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Global $g_hGUI, $g_hChild, $g_hChildMDI, $g_aPosChild, $g_iDeltaX, $g_iDeltaY Example() Func Example() $g_hGUI = GUICreate("Example", 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED) GUISetBkColor(0x202020) GUISetState(@SW_SHOW, $g_hGUI) $g_hChild = GUICreate("ChildWindow", 200, 200, 100, 100, $WS_CHILD, -1, $g_hGUI) GUISetBkColor(0xffffff) GUISetState(@SW_SHOW, $g_hChild) $g_hChildMDI = GUICreate("", 100, 100, 5, 5, $WS_POPUP, BitOr($WS_EX_MDICHILD, $WS_EX_CONTROLPARENT), $g_hChild) GUISetBkColor(0xff00ff) GUISetState(@SW_SHOW, $g_hChildMDI) _CalcPosAndDelta() GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_MOVE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($g_hChildMDI) GUIDelete($g_hChild) GUIDelete($g_hGUI) EndFunc ;==>Example Func _CalcPosAndDelta() Local $aPosChildMDI = WinGetPos($g_hChildMDI) $g_aPosChild = WinGetPos($g_hChild) $g_iDeltaX = $g_aPosChild[0] - $aPosChildMDI[0] $g_iDeltaY = $g_aPosChild[1] - $aPosChildMDI[1] EndFunc ;==>_CalcPosAndDelta Func WM_ENTERSIZEMOVE($hWnd, $iMsg, $wParam, $lParam) _CalcPosAndDelta() EndFunc ;==>WM_ENTERSIZEMOVE Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $g_hGUI Then $g_aPosChild = WinGetPos($g_hChild) WinMove($g_hChildMDI, "", $g_aPosChild[0] - $g_iDeltaX, $g_aPosChild[1] - $g_iDeltaY) EndIf EndFunc ;==>WM_SIZE
    1 point
  5. Unless there is a specific reason to mix $WS_CHILD and $WS_EX_MDICHILD, you shouldn't do that. All you will get out of it is useless complexity. Now if you want to adapt the child windows to the size of its parent, here one easy way : ; From Nine #include <GUIConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", True) Global $hChild1, $hChild2, $aPosGUI Example() Func Example() Local $hGUI = GUICreate("Example", 400, 400, Default, Default, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED) GUISetBkColor(0x202020) GUISetState() $hChild1 = GUICreate("", 200, 200, 100, 100, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFFFFFF) GUISetState() $hChild2 = GUICreate("", 100, 100, 5, 5, $WS_POPUP, $WS_EX_MDICHILD, $hChild1) GUISetBkColor(0xFF00FF) GUISetState() GUIRegisterMsg($WM_SIZE, WM_SIZE) $aPosGUI = WinGetPos($hGUI) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aPos = WinGetPos($hWnd), $aChild1 = WinGetPos($hChild1), $aChild2 = WinGetPos($hChild2) WinMove($hChild1, "", $aChild1[0], $aChild1[1], $aChild1[2] + $aPos[2] - $aPosGUI[2], $aChild1[3] + $aPos[3] - $aPosGUI[3]) WinMove($hChild2, "", $aChild2[0], $aChild2[1], $aChild2[2] + $aPos[2] - $aPosGUI[2], $aChild2[3] + $aPos[3] - $aPosGUI[3]) $aPosGUI = $aPos EndFunc ;==>WM_SIZE
    1 point
×
×
  • Create New...