473,231 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Dual Head Monitor

Hi

I'm writing a MFC C++ application using Visual .NET. I'm using a Dual
Head video card with 2 monitors. I want to start my application in the
first monitor but open a dialog box in the second monitor. I tried to
set the X position of the dialog box greather thant the first screen
resolution, but the dialog box still appear on the first monitor.

Can you help me ?

Thanks

Dec 15 '05 #1
3 7641

fournij wrote:
Hi

I'm writing a MFC C++ application using Visual .NET. I'm using a Dual
Head video card with 2 monitors. I want to start my application in the
first monitor but open a dialog box in the second monitor. I tried to
set the X position of the dialog box greather thant the first screen
resolution, but the dialog box still appear on the first monitor.

Can you help me ?


[Off Topic]
try http://groups.google.com/group/microsoft.public.vc.mfc

Dec 15 '05 #2
fournij wrote:
Hi

I'm writing a MFC C++ application using Visual .NET. I'm using a Dual
Head video card with 2 monitors. I want to start my application in the
first monitor but open a dialog box in the second monitor. I tried to
set the X position of the dialog box greather thant the first screen
resolution, but the dialog box still appear on the first monitor.

Can you help me ?

Thanks


You'll get better feedback if you post this question in a MS or VC++
newsgroup.

Here's some related info:

You could use 'MonitorFromPoint()' or 'MonitorFromWindow()' to
determine which monitor it is shown on. See also
http://msdn.microsoft.com/library/de...nitor_5isz.asp
("Positioning Objects on Multiple Display Monitors") and the associated
code sample at
http://msdn.microsoft.com/library/de...nitor_9t0w.asp
("Positioning Objects on a Multiple Display Setup"):

#include <windows.h>
#include "multimon.h"

#define MONITOR_CENTER 0x0001 // center rect to monitor
#define MONITOR_CLIP 0x0000 // clip rect to monitor
#define MONITOR_WORKAREA 0x0002 // use monitor work area
#define MONITOR_AREA 0x0000 // use monitor entire area

//
// ClipOrCenterRectToMonitor
//
// The most common problem apps have when running on a
// multimonitor system is that they "clip" or "pin" windows
// based on the SM_CXSCREEN and SM_CYSCREEN system metrics.
// Because of app compatibility reasons these system metrics
// return the size of the primary monitor.
//
// This shows how you use the multi-monitor functions
// to do the same thing.
//
void ClipOrCenterRectToMonitor(LPRECT prc, UINT flags)
{
HMONITOR hMonitor;
MONITORINFO mi;
RECT rc;
int w = prc->right - prc->left;
int h = prc->bottom - prc->top;

//
// get the nearest monitor to the passed rect.
//
hMonitor = MonitorFromRect(prc, MONITOR_DEFAULTTONEAREST);

//
// get the work area or entire monitor rect.
//
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);

if (flags & MONITOR_WORKAREA)
rc = mi.rcWork;
else
rc = mi.rcMonitor;

//
// center or clip the passed rect to the monitor rect
//
if (flags & MONITOR_CENTER)
{
prc->left = rc.left + (rc.right - rc.left - w) / 2;
prc->top = rc.top + (rc.bottom - rc.top - h) / 2;
prc->right = prc->left + w;
prc->bottom = prc->top + h;
}
else
{
prc->left = max(rc.left, min(rc.right-w, prc->left));
prc->top = max(rc.top, min(rc.bottom-h, prc->top));
prc->right = prc->left + w;
prc->bottom = prc->top + h;
}
}

void ClipOrCenterWindowToMonitor(HWND hwnd, UINT flags)
{
RECT rc;
GetWindowRect(hwnd, &rc);
ClipOrCenterRectToMonitor(&rc, flags);
SetWindowPos(hwnd, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE |
SWP_NOZORDER | SWP_NOACTIVATE);
}

Dec 15 '05 #3
fournij wrote:
I'm writing a MFC C++ application using Visual .NET. I'm using a Dual
Head video card with 2 monitors. I want to start my application in the
first monitor but open a dialog box in the second monitor. I tried to
set the X position of the dialog box greather thant the first screen
resolution, but the dialog box still appear on the first monitor.

Can you help me ?


Nope. But somebody in comp.os.ms-windows.programmer.win32 can.

V
Dec 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: KJM | last post by:
How can I detect if the user has dual monitors and then how do I control which monitor a form is displayed on. Currently my forms always come up on my right monitor. What if I want to have it...
1
by: Patrick | last post by:
I need some code for getting screenshots from the secondary monitor on dual monitor display. Here's a bit of the code for a screen from the primary monitor. Bitmap MyImage = new...
1
by: Patrick | last post by:
need some code for getting screenshots from the secondary monitor on dual monitor display. Here's a bit of the code for a screen from the primary monitor. Bitmap MyImage = new...
0
by: davsun55 | last post by:
I'm looking for a C# code example that show use of a dual monitor. My application will have a control console running on the main monitor (a la powerpoint slideshow), with a display window showing...
2
by: Mark | last post by:
Experts - I have a laptop running XP docked to a dual monitor setup. I find it quite annoying that even when I undock, I am still on dual monitor setting, which means some of my apps are on the...
8
by: Sheldon | last post by:
I just received a 2nd (configured as a dual) monitor but, for Access only, I can't seem to figure out, if it's possible, to view, say, Table1 on one monitor and Table2 on the other monitor. If I...
2
by: Cindy | last post by:
I've been using dual monitors for about a year now (absolutely love it), but have run into a weird situation with Access 2000 lately. I loaded a database on two PC's that do NOT have dual...
0
by: praveenhathwar | last post by:
I ve developed an application. My client has two monitors for a single PC. He wants to display a video clip in the second monitor continuosly (Repeatedly) and when the application in runs in Primay...
1
by: nanban4u | last post by:
Hi, Programming Language - HTML, JavaScript Web server : IIS 6 Browser : IE 6 + I am working in a Dual Monitor screen setup. I have a scenario some times the user move the IE screen from...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.