Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a small dialog based application in visual studio 2005 edition which has few buttons,edit boxes and static box etc . My problem is I want to make it full screen application irrespective of any monitor size it is running on . But whenever i m maximizing the application the dialog box hogs the whole of screen but the controls (edit box, buttons, static box etc) does remain rooted to its original position i.e it doesnot spread out uniformly to occupy the whole screen.
I have googled this problem and found some code but they are doing the same thing as maximizing the application.

Could somebody help me out please.

These are code i m using to maximize my application

// 1st solution
CRect rcDesktop;
rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
rcDesktop.right = rcDesktop.left + GetSystemMetrics(SM_CXVIRTUALSCREEN); = GetSystemMetrics(SM_YVIRTUALSCREEN);
rcDesktop.bottom = + GetSystemMetrics(SM_CYVIRTUALSCREEN);
MoveWindow(rcDesktop, FALSE);

// 2nd solution

int cx, cy; 
    HDC dc = ::GetDC(NULL); 
    cx = GetDeviceCaps(dc,HORZRES) + 
    cy = GetDeviceCaps(dc,VERTRES) +

    // Remove caption and border

    SetWindowLong(m_hWnd, GWL_STYLE, 
        GetWindowLong(m_hWnd, GWL_STYLE) & 
    (~(WS_CAPTION | WS_BORDER))); 

    // Put window on top and expand it to fill screen

    ::SetWindowPos(m_hWnd, HWND_TOPMOST, 
        cx+1,cy+1, SWP_NOZORDER);
Updated 17-Sep-11 21:51pm

1 solution

you're going to have to move the position of your controls during the WM_SIZE message

there's easysize[^] on CP
Share this answer
Amit Ranjan Das 18-Sep-11 21:36pm    
Could u please elaborate on ur solution.thanks a lot for helping me out
barneyman 18-Sep-11 21:47pm    
if you follow that link, you'll find some source that will help you to accomplish what you're after

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900