Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:00:00+00:00 2026-05-24T18:00:00+00:00

our delphi application can have multiple DirectX windows, often on multiple screens. up to

  • 0

our delphi application can have multiple DirectX windows, often on multiple screens. up to now the user had to specify the fullscreen resolution using a dropdown with the supported resolutions. it would be very nice, if he could use a setting like ‘current’ which would be the resolution of the screen on which the window is.

we are using delphi with clootie directX headers. can someone give me a hint, how i would write a method using directX, winAPI or delphi methods to get the resolution of the current screen on which the window is?

kind regards,
thalm

Final Solution:

ok, delphi 2007 MultiMon.pas returns crap for GetMonitorInfo, so i found this method, which works for me, using the winAPI directly:

function GetRectOfMonitorContainingRect(const R: TRect): TRect;
{ Returns bounding rectangle of monitor containing or nearest to R }
type
  HMONITOR = type THandle;
  TMonitorInfo = record
    cbSize: DWORD;
    rcMonitor: TRect;
    rcWork: TRect;
    dwFlags: DWORD;
  end;
const
  MONITOR_DEFAULTTONEAREST = $00000002;
var
  Module: HMODULE;
  MonitorFromRect: function(const lprc: TRect; dwFlags: DWORD): HMONITOR; stdcall;
  GetMonitorInfo: function(hMonitor: HMONITOR; var lpmi: TMonitorInfo): BOOL; stdcall;
  M: HMONITOR;
  Info: TMonitorInfo;
begin
  Module := GetModuleHandle(user32);
  MonitorFromRect := GetProcAddress(Module, 'MonitorFromRect');
  GetMonitorInfo := GetProcAddress(Module, 'GetMonitorInfoA');
  if Assigned(MonitorFromRect) and Assigned(GetMonitorInfo) then begin
    M := MonitorFromRect(R, MONITOR_DEFAULTTONEAREST);
    Info.cbSize := SizeOf(Info);
    if GetMonitorInfo(M, Info) then begin
      Result := Info.rcMonitor;
      Exit;
    end;
  end;
  Result := GetRectOfPrimaryMonitor(True);
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:00:01+00:00Added an answer on May 24, 2026 at 6:00 pm
    var
      MonInfo: TMonitorInfo;
    begin
      MonInfo.cbSize := SizeOf(MonInfo);
      GetMonitorInfo(MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST), @MonInfo);
      ShowMessage(Format('Current resolution: %dx%d',
                  [MonInfo.rcMonitor.Right - MonInfo.rcMonitor.Left,
                   MonInfo.rcMonitor.Bottom - MonInfo.rcMonitor.Top]));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Delphi (5) application that uses a log-in screen (standard user name/password)
I have an application written in Delphi 6 and compiled on Windows XP. Usually
I have just ported several of our home-made Outlook COM-addins from Delphi 2007 to
Our application is failing on one specific user's computer with ERROR_NOT_ENOUGH_MEMORY (Not enough storage
I have just used FastMM4 to detect leaks. I did not realise our application
We're looking to upgrade to Delphi 2010 and have Team Foundation Server as our
Okay -- we have an interesting problem. Some background: Our main application uses Indy
In one of our application im getting an exception that i can not seem
We have a large (about 580,000 loc) application which in Delphi 2006 builds (on
In our Delphi application, we use a TStringList to store strings and corresponding objects.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.