?
Solved

Secondary Monitor use; dedicated control from Delphi application

Posted on 2004-09-21
4
Medium Priority
?
1,000 Views
Last Modified: 2008-01-09
I am trying to allow a program to have a normal Windows UI on the Windows desktop, and also be able to write to secondary monitor. This is not about extending the Windows Desktop onto a secondary monitor, but rather letting the Delphi application take full control of the secondary monitor (in addition to a graphical UI running on the primary monitor)

I could use the secondary monitor in 80x50 text mode, or I could treat it as a graphic canvas.

Could anyone provide a code example of how an application would initialize and then write to a secondary monitor?

0
Comment
Question by:tgodfrey
[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
  • 2
4 Comments
 
LVL 2

Expert Comment

by:gary_williams
ID: 12111551
procedure TForm1.FormCreate(Sender: TObject);
begin
  if (Screen.MonitorCount >= 2) then
  begin
    Form2 := TForm2.Create(Application);

    Form2.Left := Screen.Monitors[1].Left;
    Form2.Top := Screen.Monitors[1].Top;
    Form2.Width := Screen.Monitors[1].Width;
    Form2.Height := Screen.Monitors[1].Height;
  end;
end;
0
 

Author Comment

by:tgodfrey
ID: 12111856
Thanks Gary. If I understand that code, it will create a form filling the screen of a second monitor, if the second monitor is one of a multi-monitor extended desktop created by Windows. In this case, the mouse cursor could move there, and the user could drag windows onto the second monitor on top of  the Delphi form, etc. It is just like part of the main desktop.

I guess I didn't make it clear enough: I'm trying to create a _dedicated_ display for Delphi. In the DOS days I would have written directly to the memory at B000:0000 to control a secondary monochrome monitor that was installed along with a VGA in a computer. I'm trying to get the same result here. A secondary video display, under the total control of my Delphi application, not part of the Windows desktop. (No mouse needed - status display only)

0
 
LVL 2

Accepted Solution

by:
gary_williams earned 375 total points
ID: 12112202

This code should prevent the user from moving the mouse off of the main monitor:

var
  Rect: TRect;
...
Rect := Screen.Monitors[0].BoundsRect;
ClipCursor(@Rect);

However, this may not be suitable for your application.

You could also set

Form2.FormStyle := fsStayOnTop

To prevent windows that have been partly dragged off of the main monitor from obscuring your window on the second monitor.

However, this also may not be suitable for your application.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 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