Dialog window size

This is a discussion on Dialog window size within the Windows Programming forums, part of the Platform Specific Boards category; I've noticed that it is possible to see the size of a dialog window in the status bar, far to ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    11

    Dialog window size

    I've noticed that it is possible to see the size of a dialog window in the status bar, far to the right when working in VC++ 6.

    I want a main dialog window to be 640x480. The problem is that when i set this size then it takes up far more than a quarter of my screen (which is set to 1280x1024). When I create a popup dialog and set its size to 640x480 it looks right on my screen and it is a lot smaller than the main dialog, which should be the same size.

    What can be done to solve this problem?

    Thanks for any help!

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    Your dialog resource is measured in dialog units, which are proportional to the font being used in the dialog (which can be the default). So in the first case, the size is 640x480 DLUs.

    In the second case, your popup "dialog" (I think it's a window but I can't see your code) is measured in pixels.

    If you want the main dialog to be 640x480 pixels, try using a SetWindowPos call when it receives a WM_INITDIALOG message, like so:-
    Code:
    SetWindowPos(hwndDlg, NULL, 0, 0, 640, 480, SWP_NOMOVE | SWP_NOOWNERZORDER);
    The advantage of dialog units is that dialogs will take up similar amounts of space at a variety of resolutions (because the font their based on is scaled).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. An exercise in optimization
    By Prelude in forum Contests Board
    Replies: 10
    Last Post: 04-29-2005, 03:06 PM
  3. How to Use a Dialog as Main Window?
    By Mike2432 in forum Windows Programming
    Replies: 8
    Last Post: 07-26-2002, 06:20 PM
  4. How to change window style at runtime?
    By Mr. Bitmap in forum Windows Programming
    Replies: 5
    Last Post: 06-09-2002, 04:49 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21