Click here to Skip to main content
15,897,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Error in OpenFileMapping function. Pin
Hamid_RT21-Sep-06 20:00
Hamid_RT21-Sep-06 20:00 
QuestionRe: Error in OpenFileMapping function. Pin
prasad_som21-Sep-06 20:04
prasad_som21-Sep-06 20:04 
QuestionPro grammatically importing digital certificate which only contains a public key Pin
Sudhir Mangla21-Sep-06 18:19
professionalSudhir Mangla21-Sep-06 18:19 
QuestionHow to detect full-screen window? Pin
jipai21-Sep-06 17:06
jipai21-Sep-06 17:06 
AnswerRe: How to detect full-screen window? Pin
Steve Echols21-Sep-06 17:59
Steve Echols21-Sep-06 17:59 
GeneralRe: How to detect full-screen window? Pin
jipai21-Sep-06 22:13
jipai21-Sep-06 22:13 
QuestionKeeping window within boundry, win32 sdk [modified] Pin
beeejay21-Sep-06 16:19
beeejay21-Sep-06 16:19 
AnswerRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 17:24
Nibu babu thomas21-Sep-06 17:24 
beeejay wrote:
What do I need to do??


Well here is a small code snippet which restricts the movement of a child dialog within it's parent dialog, may be this will help you..., this is MFC, you will have to do something similar in SDK.

void CCNonClippingChildDlg::OnMoving( int nSide, LPRECT lpRect ) 
{
    // Store initial co-ordinates, avoid static variables, instead use global or  
    // member variables.
    static RECT rcPreviousCoords = *lpRect;
 
    // Get parent
    CWnd *pParentDlg = GetParent();
 
    if( !pParentWnd )
        return;
 
    // Get parent rect
    CRect crParentRect;
    pParentDlg->GetClientRect( &crParentRect );
    pParentDlg->ClientToScreen( &crParentRect );
 
    // If both left and right coordinates are valid update those coordinates,
    // else reset left and right to previous valid coordinates
    if( lpRect->left <= crParentRect.left || lpRect->right >= crParentRect.right )
    {
        lpRect->left = rcPreviousCoords.left;
        lpRect->right = rcPreviousCoords.right;
    }
    else
    {
        rcPreviousCoords.left = lpRect->left;
        rcPreviousCoords.right = lpRect->right;
    }
 
    // If both top and bottom coordinates are valid update those coordinates,
    // else reset top and bottom to previous valid coordinates
    if( lpRect->top <= crParentRect.top || lpRect->bottom >= crParentRect.bottom )
    {
        lpRect->top = rcPreviousCoords.top;
        lpRect->bottom = rcPreviousCoords.bottom;
    }
    else
    {
        rcPreviousCoords.top = lpRect->top;
        rcPreviousCoords.bottom = lpRect->bottom;
    }
}


I handled the WM_MOVING message.




Nibu thomas
A Developer

Programming tips[^]  My site[^]

GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 17:34
beeejay21-Sep-06 17:34 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 17:43
Nibu babu thomas21-Sep-06 17:43 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 17:56
beeejay21-Sep-06 17:56 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 18:23
Nibu babu thomas21-Sep-06 18:23 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 18:34
beeejay21-Sep-06 18:34 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 18:36
Nibu babu thomas21-Sep-06 18:36 
GeneralRe: Keeping window within boundry, win32 sdk Pin
beeejay21-Sep-06 18:47
beeejay21-Sep-06 18:47 
GeneralRe: Keeping window within boundry, win32 sdk Pin
Nibu babu thomas21-Sep-06 19:03
Nibu babu thomas21-Sep-06 19:03 
QuestionComposite Control Info Pin
Demian Panello21-Sep-06 16:14
Demian Panello21-Sep-06 16:14 
AnswerRe: Composite Control Info Pin
Rick York21-Sep-06 16:45
mveRick York21-Sep-06 16:45 
AnswerRe: Composite Control Info Pin
Hamid_RT21-Sep-06 18:41
Hamid_RT21-Sep-06 18:41 
QuestionWarning messages Pin
dacky21-Sep-06 15:36
dacky21-Sep-06 15:36 
AnswerRe: Warning messages Pin
Stephen Hewitt21-Sep-06 16:03
Stephen Hewitt21-Sep-06 16:03 
GeneralRe: Warning messages Pin
dacky21-Sep-06 16:13
dacky21-Sep-06 16:13 
QuestionMoving VC7 app to VC8 Pin
paulb21-Sep-06 12:46
paulb21-Sep-06 12:46 
AnswerRe: Moving VC7 app to VC8 Pin
Christian Graus21-Sep-06 12:52
protectorChristian Graus21-Sep-06 12:52 
Questionweb application in vc++.net Pin
sandeep_thakur21-Sep-06 11:05
sandeep_thakur21-Sep-06 11:05 

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.