Solved

Secondary Monitor use; dedicated control from Delphi application

Posted on 2004-09-21
4
997 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 125 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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