From: bogdan on
Hi,

Can an mfc app be programmatically 'instructed' to use a specific video
adapter? As far as I know I could use EnumDisplayMonitors(),
GetMonitorInfo(), and CreateDC() to get a DC for a specific monitor. So, if
I pass a given's monitor name which is attached to one of the video adapters
I should be able to create a DC for that adapter. Is my assumption correct?
If that works (i.e. creating a DC) then how would I associate it with mfc?

Any other way to run an mfc app on a given video adapter?

Thanks,
Bogdan


From: Joseph M. Newcomer on
Why do you need a DC for the monitor? You wouldn't be drawing on it.

You can use EnumDisplayMonitors, etc., and you can get the coordinates they use, and you
can move the app over to a specific monitor. But in a multimonitor system, it is the user
(not you) who determines the position of each monitor relative to the main monitor, so in
a 2-monitor system, I could have (where P is the primary and S is the secondary) any of
the following

P S
S P

P
S

S
P

P
S

S
P

S
P

P
S

and that's just the simple relationships I can display using simple character layout! Note
that in a multimonitor system where the monitors have different resolutions, I can set the
secondary to be aligned top or bottom with the primary.

There is nothing you can predict about monitor layout.

Note that it is pefectly legitimate to have screen coordinates like -1200,-1024.

So you can store your current window coordinates (e.g., in the Registry) so when the app
starts up, it reads the stored coordinates of where it was last found and restores itself
there, although this just "sorta" works; if the user has rearranged the monitor layout in
the meantime, it could also mean you launch the app then move it somewhere which is not on
any screen, so you first need to validate that the coordinates you stored correspond to
coordinates that are still valid, and if they do not, then just bring it up on the primary
monitor.
joe

On Tue, 2 Mar 2010 09:04:46 -0500, "bogdan" <bogdan(a)nocompany.com> wrote:

>Hi,
>
>Can an mfc app be programmatically 'instructed' to use a specific video
>adapter? As far as I know I could use EnumDisplayMonitors(),
>GetMonitorInfo(), and CreateDC() to get a DC for a specific monitor. So, if
>I pass a given's monitor name which is attached to one of the video adapters
>I should be able to create a DC for that adapter. Is my assumption correct?
>If that works (i.e. creating a DC) then how would I associate it with mfc?
>
>Any other way to run an mfc app on a given video adapter?
>
>Thanks,
>Bogdan
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm