Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that you must be calling <code>GetMonitorInfo</code> incorrectly. This code:</p> <pre><code>{$APPTYPE CONSOLE} uses SysUtils, MultiMon, Windows, Forms; var i: Integer; MonitorInfo: TMonitorInfoEx; begin MonitorInfo.cbSize := SizeOf(MonitorInfo); for i := 0 to Screen.MonitorCount-1 do begin if not GetMonitorInfo(Screen.Monitors[i].Handle, @MonitorInfo) then RaiseLastOSError; Writeln(MonitorInfo.szDevice); end; Readln; end. </code></pre> <p>produces this output on my machine:</p> <pre> \\.\DISPLAY1 \\.\DISPLAY2 </pre> <p>I suspect that your call to <code>GetMonitorInfo</code> is failing in some way and perhaps you are not checking the return value for errors.</p> <hr> <p>Having searched QualityCentral I suspect you have fallen victim to a known bug in older versions of Delphi: <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=3239" rel="nofollow">QC#3239</a>. This is reported fixed in version 10.0.2124.6661 which is Delphi 2006.</p> <hr> <p>Your comments confirm this diagnosis. To fix the problem you'll need a new <code>TMonitorInfoEx</code> definition. Here's one that will work on your pre-Unicode Delphi:</p> <pre><code>type TMonitorInfoEx = record cbSize: DWORD; rcMonitor: TRect; rcWork: TRect; dwFlags: DWORD; szDevice: array[0..CCHDEVICENAME - 1] of AnsiChar; end; </code></pre> <p>If you add that to the code above (before you declare the variables of course) then I believe it will resolve your problem.</p> <hr> <p>As an interesting aside, even in XE3, these structs have not been translated correctly: <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=114460" rel="nofollow">QC#114460</a>. Admittedly the error is rather benign as it only affects <code>PMonitorInfoExA</code> and <code>TMonitorInfoExA</code>, but the error caught me out whilst trying to solve the problem in this question!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload