?
Solved

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

Posted on 2003-04-01
12
Medium Priority
?
848 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:Edocecrous
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
12 Comments
 
LVL 8

Expert Comment

by:Exceter
ID: 8246694
Listening...
0
 

Author Comment

by:Edocecrous
ID: 8247608
Listening to what? Is the question not clear?
I want to know, how to print to the secondary monitor, details above.
Edocecorus
0
 

Expert Comment

by:ritchiep
ID: 8248160
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:Exceter
ID: 8249246
>> 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
0
 
LVL 2

Expert Comment

by:MirkoLMV
ID: 8253949
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 !
0
 

Expert Comment

by:ritchiep
ID: 8254140
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.
0
 

Author Comment

by:Edocecrous
ID: 8255998
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
0
 

Author Comment

by:Edocecrous
ID: 8256815
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!
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 2000 total points
ID: 8706145
>> HDC SecMon = CreateDC("DISPLAY","\\.\Display2",NULL,&DMode);

Try doubling up the backslashes for fun and profit:

        HDC SecMon = CreateDC("DISPLAY","\\\\.\\Display2",NULL,&DMode);

Some useful info here:

        http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20333782.html

I've read that it is not possible to access the good-old DOS-style full-screen character/attributes on the secondary console from Mike Blasm who seems to know his stuff.   But I never looked into it becasue... who cares?  Just make the monitor part of the desktop and open a window on it.

-- Dan
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9587429
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

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9587498
I believe that the correction I provided to the Asker's code and the link I provided would solve the question.
-- Dan
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question