Solved

Secondary Monitor use; dedicated control from Delphi application

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now