?
Solved

API for Monitor Detection

Posted on 2003-03-12
2
Medium Priority
?
767 Views
Last Modified: 2011-09-20
I want to know how I can get the monitor name(or type) connect to my
display card,if mutiple display in use,how enum all of them?
0
Comment
Question by:qzdmmx
[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 Comments
 
LVL 3

Expert Comment

by:emadat
ID: 8119798
For the monitors count, you can use this function:

function MonitorsCount: integer;
var
    TM : TScreen;
begin
    TM := TScreen.Create(Nil);
    try
     result := TM.MonitorCount;
    finally
     TM.Free;
    end;
end;

you can get the properties of each monitor using the Monitors collection of the TScreen object "TM.Monitors in our example".
0
 
LVL 1

Accepted Solution

by:
Noturno earned 75 total points
ID: 8120598
For give me for my poor english (i'm brazilian)

You can get all monitor information by using an API function called GetMonitorInfo:

BOOL GetMonitorInfo(
  HMONITOR hMonitor,  // handle to display monitor
  LPMONITORINFO lpmi  // display monitor information
);

You can get the monitor handle by using the TMonitor class:

//-------------------------
procedure GetMonitors;
var
   A: Integer;
   MI: LPMONITORINFO;
begin
   with Screen Do
   begin
      for A:= o to MonitorCount - 1 Do
      begin
         GetMonitorInfo(Monitors[A].Handle, MI);
         // Display information of the monitor using MI
      end;
   end;
end;
//-------------------------

You will need to implement the structure of LPMONITORINFO:

typedef struct tagMONITORINFO {
  DWORD  cbSize;
  RECT   rcMonitor;
  RECT   rcWork;
  DWORD  dwFlags;
} MONITORINFO, *LPMONITORINFO;

I don't translate it to pascal because I've copied it from the msdn. You can get this information at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/monitor_27e7.asp
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
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…
Suggested Courses

752 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