Post Reply

Forums -> UltraMon™ SDK -> Finding the handle of a particular monitor and Bitblt
Matt   2005-12-06 11:11
Hi Guys, a friend has asked me to write an application where I need to have 12 monitors.
1 Master, 11 others.
On the Master, I need to tile previews of whats going on the other 11 Monitors. It doesn't have to be realtime, so I don't need mirroring.
I was thinking of taking a bitblt screen shot of each monitor and putting them into pictureboxes inside a vb app to do this.
How do I get the handle of each monitor using the Ultramon SDK so I can pass it to the Bitblt function?

The other feature I need, is that the user can click on one of the preview boxes to show that monitor on the Master Monitor. I guess this would mean I would HAVE to use mirroring? Any suggestions on this? Would I do this by using the command line and the separate mirroring utility?

Thanks in advance for any advice guys,
Matt.
Christian Studer   2005-12-07 07:56

You could either create a device context for the whole desktop, or use CreateDC to create a device context for a specific monitor.

Here are samples for both approaches, Preview is a PictureBox object:

Private Sub PreviewUpdate1() Dim sys As New ULTRAMONLib.UltraMonSystem Dim mon As ULTRAMONLib.IUltraMonMonitor Set mon = sys.Monitors("2") Dim dc As Long: dc = GetDC(0) Dim rc As RECT: GetClientRect Preview.hwnd, rc StretchBlt Preview.hdc, 0, 0, rc.Right, rc.Bottom, dc, mon.Left, mon.Top, mon.Width, mon.Height, SRCCOPY ReleaseDC 0, dc End Sub Private Sub PreviewUpdate2() Dim sys As New ULTRAMONLib.UltraMonSystem Dim mon As ULTRAMONLib.IUltraMonMonitor Set mon = sys.Monitors("2") Dim dc As Long: dc = CreateDC(mon.AdapterDeviceName, vbNullString, vbNullString, vbNullString) Dim rc As RECT: GetClientRect Preview.hwnd, rc StretchBlt Preview.hdc, 0, 0, rc.Right, rc.Bottom, dc, 0, 0, mon.Width, mon.Height, SRCCOPY DeleteDC dc End Sub

To use mirroring from your application, you could run UMMirrorClient.exe with the /w argument, and use a control as the parent window:

Shell "C:\Program Files\UltraMon\UMMirrorClient.exe /w 1,0,0,0," & Picture1.hWnd

For more on UMMirrorClient.exe command line arguments, see UltraMon Help > Scripting > Command-line arguments.



Christian Studer - www.realtimesoft.com
Matt   2005-12-07 14:09
Chris, thanks so much for the detailed reply - I'll give this a try over the weekend and let you know how it goes!

Love your work.

Best Regards,
Matt.
Forums -> UltraMon™ SDK -> Finding the handle of a particular monitor and Bitblt

Post Reply