Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Toggle window to monitor.
#1
I would like a "Ctr+Shift+L.Click" mouse trigger that will move an active window from one monitor display to the other.

Thanks,
Jimmy Vig
#2
MoveWindowToMonitor
#3
This I've done to get a window to move to the secondary monitor:
Function Function46
Code:
Copy      Help
int hwnd=win()
MoveWindowToMonitor hwnd 2

The problem is using "Ctl+Shift+L.Click" to move the window back to the primary monitor.

I figure there must be a way to determine what monitor a window is currently active on and then toggle which monitor from there.

So yeah, the big hang up is determining which monitor.

I thought of determining through the mouse click position like this:
Dual Monitors - window becomes active when mouse is in monit

Then running a script...that would work, but you probably know some magical way of doing this I've never heard of!

Thanks,
jimmy vig
#4
Function Monitor_Toggle
Trigger #CSL 0x9     Help - how to add the trigger to the macro
Code:
Copy      Help
int mon pmon
POINT p; xm p
mon=MonitorFromPoint(p MONITOR_DEFAULTTONULL)
sel mon
,case 1180117
,int hwnd=win()
,MoveWindowToMonitor hwnd 1
,case 7340581
,hwnd=win()
,MoveWindowToMonitor hwnd 2

So this works...and I'm sure it will probably only work on this machine. Is there a better way to determine what monitor a window is on?

Thanks,
Jimmy Vig
#5
Function Function47
Trigger #CSL 0x9     Help - how to add the trigger to the macro
Code:
Copy      Help
int hwnd hMonitor

hwnd=win()

MONITORINFO mi.cbSize=sizeof(mi)

hMonitor=MonitorFromWindow(hwnd MONITOR_DEFAULTTONEAREST)
GetMonitorInfo(hMonitor &mi)
out mi.dwFlags
sel mi.dwFlags
,case 0
,MoveWindowToMonitor hwnd 1
,case 1
,MoveWindowToMonitor hwnd 2
#6
Any way of doing this with QM?
http://www.mediachance.com/free/multimon.htm
#7
QM has function MonitorIndex.

From QM help:
Quote:#MonitorIndex hmonitor ;;Returns 1-based monitor index.


QM 2.2.1.

Returns 1-based monitor index. Returns 0 if the handle is invalid.



hmonitor - monitor handle.
#8
I'm giving a secondary monitor taskbar a go. I'm really thinking that I want it to work as a dialog so that I can run it as an exe and have hotkeys without QM running on the machines...I have quite a few systems I want to put this on!

_pi has made some pretty good headroom on this: http://www.quickmacros.com/forum/showthr...p?tid=1796

I've been dissecting his work and will be working though it all over the next couple days. I'm gonna switch over to that thread for any questions and solutions I come up with Smile

Thanks,
Jimmy Vig
#9
3/2 years later ...

Function windowsPerMonitor
Code:
Copy      Help
function [mon]
out
int hwnd hMonitor c1 ;str exe titles
ARRAY(int) handles h_left h_middle h_right
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles

for(c1 0 arr.len) ;; c1 is counter 1
,hwnd=handles[c1]
,hMonitor=MonitorFromWindow(hwnd MONITOR_DEFAULTTONEAREST)
,sel MonitorIndex(hMonitor)
,,case 1 h_right[] = hwnd
,,case 2 h_middle[] = hwnd
,,case 3 h_left[] = hwnd
,,
;out h_left.len
;out h_middle.len
;out h_right.len

for(c1 0 h_left.len)
,out "%s" exe.getwintext(h_left[c1])
,
for(c1 0 h_middle.len)
,out "%s" exe.getwintext(h_middle[c1])
,
for(c1 0 h_right.len)
,out "%s" exe.getwintext(h_right[c1])
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)