Link to home
Start Free TrialLog in
Avatar of Edocecrous
Edocecrous

asked on

How to access the text mode screen on the secondary monitor in a system with 2 vga card?

Hi!

I have dual-monitor systems, and Windows 98.

My question is, how to access (write-to) the secondary monitor, if the monitor is not selected to be included in the windows virtual desktop?

So windows recognises the card, but the 'Extend my Windows desktop onto this monitor' switch is not on)
You are in this mode, when you see the following text on the secondary monitor:
"If you can read this message, Windows has successfully initialized this display adapter...."

I want to use it as a debug-monitor, just like i did in the old MDA/Hercules times.
If windows can use it in text mode, so can we.

I managed to get the device name with EnumDisplayDevices(), and also i tried to create a DC with CreateDC("DISPLAY",&DeviceName,NULL,NULL);
But i might be on a wrong track...

Edocecrous
Avatar of Exceter
Exceter
Flag of United States of America image

Listening...
Avatar of Edocecrous
Edocecrous

ASKER

Listening to what? Is the question not clear?
I want to know, how to print to the secondary monitor, details above.
Edocecorus
You would have to start by writing a device driver for that device.  Windows will not let you simply write the the vga memory of that card to display text on the monitor attached to that card.

If you want to simply use it like the other monitor you can move your windows into that monitor so they are only displayed there.

Is there something more you want to do other than simply display information on that monitor from a Windows application?  If so, I would simply move your windows into the space in that monitor and have fun.
>> Listening to what? Is the question not clear?

No, I meant that I am interested in this topic as well and that I am listening to see what other experts have to say about it.

Exceter
I am sorry, but I have not studied the problem. I have done most of debugging by code instrumentation and every new module was firstly a small application. And most people heve done this way.
However, I am convinced that the answer is somewhere in the Microsoft references (msdn.microsoft.com/library), in the sections for WindowsAPI. Maybe the functions for system information are a departure point. The device context is an approach in fair accord to the logic of the Windows API, therefore is worth to search there too. Even a search there on the keywords "secondary monitor" (or something related) is worth to try.
Sorry for leaving the issue like that, but Windows API is an incredibly vast universe...

Good luck !
To be more detailed, you can get the count of monitors with GetSystemMetrics(SM_MONITORS) 98+/2000+.

You can find the bounds of the virtual screen (the rectangle bounded by all monitors) with GetSystemMetrics(SM_CXVIRTUALSCREEN) and GetSystemMetrics(SM_CYVIRTUALSCREEN).  This would allow you to place a window a specific coordinate on one of the monitors.

You can get the size of the primary monitor with GetSystemMetrix(SM_CXSCREEN) and GetSystemMetrix(SM_CYSCREEN).

All the above can be used to decide (in a two monitor system) the proximity of the monitors (side-by-side, above-one-another) and decide where you want to move your "debug" window.

Alternatively, upon application start-up, you may use EnumDisplayMonitors() (with a NULL HDC and a NULL LPCRECT) to get the virtual-screen coordinates of all display monitors.

When using EnumDiplayMonitors(), in your MONITORENUMPROC, you can call GetMonitorInfo() with the HMONITOR handle to decide which is the primary monitor.

There several examples on MSDN and MSJ, etc.  Try searching for "EnumDisplayMonitors" and "GetMonitorInfo" on google for a specific code snippet.

Good luck.
Hi!
Thanx for the comments.

But i specifically asked how to access it, when it's NOT part of the windows virtual desktop.

All that:
GetSystemMetrics(SM_CXVIRTUALSCREEN) and GetSystemMetrics(SM_CYVIRTUALSCREEN), etc. are for shared desktops on multimonitor systems.
Also, i can enumerate the cards, with EnumDisplayDevices(), even if it's not part of the virtual desktop.

I do know, how to put my app's window on the secondary monitor in a wirtual desktop. But that's not my goal, and not my question.

I'm almost positive, it can be solved without writing a device driver for it, since that's why windows requires a special driver from the manufacturer of the secondary card , for multimonitor support.

I do have that driver, and windows does initialises the card, and does display text output on it.

1 more thing, the why:
If you allow windows to 'extend the desktop' to that monitor, it affects all of the programs, and your desktop too. (Also, it messes with some applications not designed with multi-monitor support in head).
If you have a Monochrome monitor attached to the system through an MDA card, is the best solution. However, not all motherboards have the old ISA bus slot, not to mention eye-friendly TFT monochrome monitor existence (with MDA support).


So keep the good ideas coming!!!!

Edocecrous
One more thing:

Plese if you found it, do not post this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/monitor_2eur.asp

That's all Microsoft has to say about this subject. Yes, it exist, sure you can use it. Did they ever tried it?
Some example from Micro$oft would come handy...

If someone manage to make it work, please post it...

So far:
I used EnumDisplayDevices(); and got back my secondary card's name, and the 'DeviceName' which is simply: "\\.\Display2"

Than, i used this: (as advised by MS)
HDC SecMon = CreateDC("DISPLAY","\\.\Display2",NULL,&DMode);
I did got back a number, but does not matter what function i try it with, it displays stuff on my primary monitor, just like it does with NULL as hdc.

Stuff like TextOut(SecMon,0,0,"Hello",5);
Actually it's a graphical function, so i'm not suprised if it's NOT working.

ps.:
I also tried EnumDisplaySettings(), it gives 'something' back, if you supplie a mode number, i try 8. But when i try one of the switches, i got back nothing.

and ChangeDisplaySettingsEx(); was not working for me.
(on the secondary monitor of course)

This is the point where some VC++ genie could come forward
with the solution.

By the way, if i put windows in text mode (probably not possible), how would i display a string?
Maybe there are functions to 'send' a string to this 'device' ???

Heeeeeeeeeelp!
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Full of information but unanswered: PAQ/Refund

Please leave any comments here within the next seven days. Experts: Silence
means you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer

I believe that the correction I provided to the Asker's code and the link I provided would solve the question.
-- Dan