Solved

Secondary Monitor use; dedicated control from Delphi application

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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