Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exact Placement of window
#1
Is there a way to make a macro to remember and place a window in the exact same position each time program is run?
#2
Yes, but need some programming. Easier would be to use some window manager program instead. Especially if you have many such windows.

If you want to use QM for it, here is one of possible ways. This function runs automatically when is shown window specified in its trigger. It restores previous position, waits for window moves and then saves its new position. It exits when the window is closed.

This example uses the QM "Mouse" dialog as an example window for testing. Change the trigger to match your window. If you have several such windows, create several such functions and change trigger and the "qm_mouse" string. If you have many such windows, I don't recommend to use this function because it will start to use some CPU. Then better use a window manager program.

Function remember_position_of_qm_mouse_dialog
Trigger !cv"Mouse" "#32770" "" "" "" 0x2 /QM     Help - how to add the trigger to the macro
Code:
Copy      Help
;\
int hwnd=TriggerWindow
;outw hwnd
RegWinPos hwnd "qm_mouse" "RegWinPos" 0
RECT r; GetWindowRect hwnd &r
rep
,1
,RECT rr; if(!GetWindowRect(hwnd &rr)) break
,if memcmp(&r &rr sizeof(r))
,,if(!IsWindowVisible(hwnd)) break
,,;out "moved"
,,r=rr
,,RegWinPos hwnd "qm_mouse" "RegWinPos" 1


Forum Jump:


Users browsing this thread: 1 Guest(s)