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

  • SEARCH
  • Home
  • 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 7546671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:15:34+00:00 2026-05-30T09:15:34+00:00

I need to determine the size of a dialog client area as defined in

  • 0

I need to determine the size of a dialog client area as defined in the resource file.

GetClientRect clips the design size by the size of the desktop. I need the size as designed in screen units. I found this which purports to retrieve the size form the dialog resource but sadly it uses MFC.

I have the dialog open and have its HWND and it’s ID. How can I get the dsign size in screen units without using MFC stuff?

  • 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-30T09:15:36+00:00Added an answer on May 30, 2026 at 9:15 am
    SIZE GetDialogSize(INT nResourceId, BOOL bApproximateCalcMethod = FALSE, LPCTSTR strDllName = NULL)
    {
    
        SIZE dlgSize = {0}; 
        HINSTANCE hModule = 0;
    
        if(strDllName != NULL)   
            hModule= ::LoadLibrary(strDllName);              
        else
            hModule = ::GetModuleHandle(NULL);   
    
        HRSRC hRsrc = ::FindResource(hModule, MAKEINTRESOURCE(nResourceId), RT_DIALOG);  
    
        HGLOBAL hTemplate = ::LoadResource(hModule, hRsrc);  
    
        DLGTEMPLATE* pTemplate = (DLGTEMPLATE*)::LockResource(hTemplate);
    
        if (bApproximateCalcMethod) // the approximate method of calculating
        {
            LONG dlgBaseUnits = GetDialogBaseUnits();
            int baseunitX = LOWORD(dlgBaseUnits), baseunitY = HIWORD(dlgBaseUnits);
            dlgSize.cx = MulDiv(pTemplate->cx, baseunitX, 4);
            dlgSize.cy = MulDiv(pTemplate->cy, baseunitY, 8);
        }
        else // the accurate method of calculation
        {
            HWND hDlg = ::CreateDialogIndirect(0, pTemplate, NULL, DialogProc);         
            RECT rc = {0};
            ::GetWindowRect(hDlg, &rc);
            ::DestroyWindow(hDlg);
    
            dlgSize.cx = rc.right - rc.left;
            dlgSize.cy = rc.bottom - rc.top;
        }
    
        UnlockResource(hTemplate);
        ::FreeResource(hTemplate);
    
        if(strDllName != NULL)
            ::FreeLibrary(hModule);
    
        return dlgSize;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to determine the size of a very large character-encoded file. A read
Reading file using java and jcifs on windows. I need to determine size of
this is for an assignment at school, where I need to determine the size
I need to determin the byte size of a file. The coding language is
I need to determine in 80% if a file is binary or text, is
I need to determine file type (i.e., MimeType) of stored data in the SQL
Is there a way to determine the size and position of the visible area
i need to compare the size of 10 queues and determine the least one
Is it possible in Delphi to determine the size of a file as it
My winform application is launched by another application (the parent), I need determine the

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.