Click here to Skip to main content
15,913,115 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries Pin
K ARUN KUMAR4-May-10 0:10
K ARUN KUMAR4-May-10 0:10 
GeneralRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries Pin
Richard MacCutchan4-May-10 1:45
mveRichard MacCutchan4-May-10 1:45 
AnswerRe: Use a CFrameWind. Pin
Software_Developer4-May-10 0:16
Software_Developer4-May-10 0:16 
GeneralRe: Use a CFrameWind. Pin
K ARUN KUMAR4-May-10 0:27
K ARUN KUMAR4-May-10 0:27 
GeneralRe: CFormView and Child Dialogs (read thisprevious post) Pin
Software_Developer4-May-10 0:50
Software_Developer4-May-10 0:50 
GeneralRe: CFormView and Child Dialogs (read thisprevious post) Pin
K ARUN KUMAR4-May-10 1:00
K ARUN KUMAR4-May-10 1:00 
AnswerRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries Pin
David Crow4-May-10 3:00
David Crow4-May-10 3:00 
GeneralRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified] Pin
K ARUN KUMAR4-May-10 18:21
K ARUN KUMAR4-May-10 18:21 
Thanks David..

That worked.

One more thing.
If the dialog is a modeless dialog and if the
user goes back to the main frame window and moves the
window, the modeless dialog will go out of application.

So for this i have added the WM_MOVING event in MainFrame class.

void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect)
{
//CFrameWnd::OnMoving(fwSide, pRect);
HWND hWnd = pDlg->GetSafeHwnd();

RECT rc;
RECT* pRc=&rc;
rc.left=rc.top=rc.right=rc.bottom=0;
LRESULT result = ::SendMessage(hWnd, WM_MOVING, (WPARAM)fwSide, (LPARAM)&rc);
}

and modified the WM_MOVING handler of Modeless Dialog as below.

void CModelessDlg::OnMoving(UINT fwSide, LPRECT pRect)
{
CDialog::OnMoving(fwSide, pRect);
CRect rcParent;

if(pRect->right==0) //Calin from MainFrame
GetWindowRect(pRect);
GetOwner()->GetWindowRect(rcParent);
// keep the child's left edge inside the parent's right edge
pRect->left = min(pRect->left, rcParent.right - m_nWidth);
// keep the child's left edge inside the parent's left edge
pRect->left = max(pRect->left, rcParent.left);

// keep the child's top edge inside the parent's bottom edge
pRect->top = min(pRect->top, rcParent.bottom - m_nHeight);
// keep the child's top edge inside the parent's top edge
pRect->top = max(pRect->top, rcParent.top);

// keep the child's right edge inside the parent's right edge
pRect->right = min(pRect->right, rcParent.right);
// keep the child's right edge inside the parent's left edge
pRect->right = max(pRect->right, rcParent.left + m_nWidth);

// keep the child's bottom edge inside the parent's bottom edge
pRect->bottom = min(pRect->bottom, rcParent.bottom);
// keep the child's bottom edge inside the parent's top edge
pRect->bottom = max(pRect->bottom, rcParent.top + m_nHeight);

if((rcParent.Width() < pRect->right - pRect->left) || (rcParent.Height() < pRect->bottom - pRect->top))
{
this->ShowWindow(SW_HIDE);
}
else
this->ShowWindow(SW_SHOW);

this->MoveWindow(pRect); //Added by Arun
}

Once again Thanks a lot David..... Smile | :)

modified on Wednesday, May 5, 2010 5:31 AM

Questionwin32 debug to win32 release mode in vc6 Pin
Member 36537513-May-10 18:52
Member 36537513-May-10 18:52 
AnswerRe: win32 debug to win32 release mode in vc6 Pin
Software_Developer3-May-10 19:23
Software_Developer3-May-10 19:23 
GeneralRe: win32 debug to win32 release mode in vc6 Pin
Member 36537513-May-10 19:57
Member 36537513-May-10 19:57 
QuestionRe: win32 debug to win32 release mode in vc6 Pin
David Crow4-May-10 3:04
David Crow4-May-10 3:04 
Questionhelp with graph syntax Pin
Member 38225323-May-10 15:35
Member 38225323-May-10 15:35 
AnswerRe: help with graph syntax Pin
enhzflep3-May-10 16:19
enhzflep3-May-10 16:19 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 16:39
Member 38225323-May-10 16:39 
GeneralRe: help with graph syntax Pin
enhzflep3-May-10 17:01
enhzflep3-May-10 17:01 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 17:10
Member 38225323-May-10 17:10 
GeneralRe: help with graph syntax Pin
enhzflep3-May-10 17:28
enhzflep3-May-10 17:28 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 17:30
Member 38225323-May-10 17:30 
GeneralRe: help with graph syntax Pin
Cedric Moonen3-May-10 20:30
Cedric Moonen3-May-10 20:30 
Questionatof conversion issue Pin
kasi143-May-10 12:14
kasi143-May-10 12:14 
AnswerRe: atof conversion issue Pin
Tim Craig3-May-10 12:26
Tim Craig3-May-10 12:26 
AnswerRe: atof conversion issue Pin
Stephen Hewitt3-May-10 14:00
Stephen Hewitt3-May-10 14:00 
Questionmaking ini file in Documents and Settings WritePrivateProfileString to Pin
malaugh3-May-10 12:01
malaugh3-May-10 12:01 
AnswerRe: making ini file in Documents and Settings WritePrivateProfileString to Pin
PJ Arends3-May-10 13:18
professionalPJ Arends3-May-10 13:18 

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.