Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How to get screen size in millimeters or inches? Pin
David Crow27-Jan-06 3:34
David Crow27-Jan-06 3:34 
AnswerRe: How to get screen size in millimeters or inches? Pin
includeh1027-Jan-06 14:59
includeh1027-Jan-06 14:59 
QuestionWM_NCPAINT minimize/restore Pin
picazo26-Jan-06 13:00
picazo26-Jan-06 13:00 
AnswerRe: WM_NCPAINT minimize/restore Pin
includeh1026-Jan-06 15:35
includeh1026-Jan-06 15:35 
GeneralRe: WM_NCPAINT minimize/restore Pin
picazo26-Jan-06 18:17
picazo26-Jan-06 18:17 
GeneralRe: WM_NCPAINT minimize/restore Pin
includeh1026-Jan-06 21:05
includeh1026-Jan-06 21:05 
QuestionDialog Full Screen Pin
JBAK_CP26-Jan-06 11:51
JBAK_CP26-Jan-06 11:51 
AnswerRe: Dialog Full Screen Pin
Stephen Hewitt26-Jan-06 13:01
Stephen Hewitt26-Jan-06 13:01 
You would have to move all the child controls. You could do it something like this:

struct OffsetInfo
{
     OffsetInfo(HWND hWnd, int OffsetX, int OffsetY):
      m_hDialog(hDialog), m_OffsetX(OffsetX), m_OffsetY(OffsetY)
     {}

     HWND m_hDialog;
     int m_OffsetX;
     int m_OffsetY;
};
 
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
     // Get access to data.
     OffsetInfo* pInfo = reinterpret_cast<OffsetInfo*>(lParam);
 
     // Get the position of the child.
     RECT rc;
     GetWindowRect(hwnd, &rc); // We're assuming success here.
     POINT pt = {rc.left, rc.top};
     ScreenToClient(pInfo->m_hDialog, &pt); // We're assuming success here.
  
     // Offset the child position.
     pt.x += pInfo->m_OffsetX;
     pt.y += pInfo->m_OffsetY;
 
     // Move the child.
     SetWindowPos(hwnd, NULL, pt.x, pt.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
 
     return TRUE; // Continue enumeration.
}
 
void CYourDialog::DoIt()
{
     // Before the dialog is expanded.
     CRect rcBefore;
     GetClientRect(&rcBefore);
 
     // Expand the dialog here......
 
     CRect rcAfter;
     GetClientRect(&rcAfter);
  
     // Now we move the children.
     OffsetInfo oi(m_hWnd, (rcAfter.Width()-rcBefore.Width())/2, (rcAfter.Height()-rcBefore.Height())/2);
     EnumChildWindows(m_hWnd, &EnumChildProc, reinterpret_cast<LPARAM>(&oi));
}


Note: I haven't tested this code but I believe that the concept is sound.


Steve
GeneralRe: Dialog Full Screen Pin
JBAK_CP26-Jan-06 13:26
JBAK_CP26-Jan-06 13:26 
QuestionIP Header Pin
Mohammad A Gdeisat26-Jan-06 11:44
Mohammad A Gdeisat26-Jan-06 11:44 
AnswerRe: IP Header Pin
Gerald Schwab26-Jan-06 12:59
Gerald Schwab26-Jan-06 12:59 
AnswerRe: IP Header Pin
Sebastian Schneider27-Jan-06 0:44
Sebastian Schneider27-Jan-06 0:44 
GeneralRe: IP Header Pin
Mohammad A Gdeisat27-Jan-06 2:00
Mohammad A Gdeisat27-Jan-06 2:00 
QuestionMove button at runtime Pin
masnu26-Jan-06 9:34
masnu26-Jan-06 9:34 
AnswerRe: Move button at runtime Pin
David Crow26-Jan-06 9:58
David Crow26-Jan-06 9:58 
GeneralRe: Move button at runtime Pin
masnu26-Jan-06 10:07
masnu26-Jan-06 10:07 
AnswerRe: Move button at runtime Pin
MANISH RASTOGI26-Jan-06 17:27
MANISH RASTOGI26-Jan-06 17:27 
AnswerRe: Move button at runtime Pin
Michael Dunn26-Jan-06 20:37
sitebuilderMichael Dunn26-Jan-06 20:37 
AnswerRe: Move button at runtime Pin
toxcct26-Jan-06 21:59
toxcct26-Jan-06 21:59 
GeneralRe: Move button at runtime Pin
Owner drawn26-Jan-06 23:35
Owner drawn26-Jan-06 23:35 
Questionchild frame fills main frame? Pin
LeeeNN26-Jan-06 7:52
LeeeNN26-Jan-06 7:52 
Questionsplitter window dynamic merge too panes. Pin
LeeeNN26-Jan-06 7:46
LeeeNN26-Jan-06 7:46 
AnswerRe: splitter window dynamic merge too panes. Pin
David Crow26-Jan-06 8:13
David Crow26-Jan-06 8:13 
QuestionPainting in "CFormView::OnPaint" over controls Pin
AnTri26-Jan-06 7:41
AnTri26-Jan-06 7:41 
QuestionAlternatives to WinHTTP and SoapToolkit? Pin
Ed K26-Jan-06 5:10
Ed K26-Jan-06 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.