Solved

Secondary Monitor use; dedicated control from Delphi application

Posted on 2004-09-21
4
994 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
  • 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
I want to use librsync in my Delphi backup application. 3 69
update joined tables 2 62
scroll down TListBox component in Delphi 1 31
Delphi, TImage, Png 2 19
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

763 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