Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Dialog Control GetDlgItem GetWindowRect MoveWindow WinMetrics Dialog Units Pixel
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DlgMoveControl ;; ;; Moves a WIL dialog control to the specified location within ;; the the dialog's client area. ;; ;; hDialog - window handle to WIL dialog ;; nControl - template position number of dialog control ;; nX - new horizontal location of upper left hand ;; corner of control relative to the upper ;; left hand corner of the dialog's client area ;; in dialog units ;; nY - new virtical location of upper left hand ;; corner of control relative to the upper ;; left hand corner of the dialog's client area ;; in dialog units ;; ;; No error handling! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction DlgMoveControl(hDialog, nControl, nX, nY) ; Get a handle to the user32.dll system dll. hUser32 = DllLoad(DirWindows(1):"USER32.DLL") ; Keep snow++ happy. ; Get control's window handle. ; WIL dialog control's ID is always the number offset by 99. hControl = DllCall(hUser32, long:"GetDlgItem", long:hDialog, long:nControl+99) ; Convert from Dialog Units to pixels. nPixelX = nX * WinMetrics(-6) nPixelY = nY * WinMetrics(-5) ; Get the current size so we can move and not resize too. hRect = BinaryAlloc(16) DllCall(hUser32, long:"GetWindowRect", long:hControl, lpbinary:hRect) nWidth = BinaryPeek4(hRect, 8) - BinaryPeek4(hRect, 0) nHeight = BinaryPeek4(hRect, 12) - BinaryPeek4(hRect, 4) BinaryFree(hRect) ; Finally we move the control. DllCall(hUser32, long:"MoveWindow", long:hControl, long:nPixelX, long:nPixelY, long:nWidth, long:nHeight, long:@TRUE) DllFree(hUser32) #EndFunction
Article ID: W17782
Filename: Move Controls in Dialog.txt
File Created: 2008:10:09:08:40:16
Last Updated: 2008:10:09:08:40:16