Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: perform action on close [X] button Pin
elephantstar28-Jun-04 13:13
elephantstar28-Jun-04 13:13 
GeneralRe: perform action on close [X] button Pin
Neville Franks28-Jun-04 13:20
Neville Franks28-Jun-04 13:20 
GeneralRe: perform action on close [X] button Pin
elephantstar28-Jun-04 14:51
elephantstar28-Jun-04 14:51 
GeneralRe: perform action on close [X] button Pin
Neville Franks28-Jun-04 14:57
Neville Franks28-Jun-04 14:57 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 8:23
elephantstar29-Jun-04 8:23 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 10:38
Neville Franks29-Jun-04 10:38 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 13:01
elephantstar29-Jun-04 13:01 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 13:43
Neville Franks29-Jun-04 13:43 
You could try using CMyView::OnNcLButtonDown() to work out if the close button is pressed or code like:


BOOL
CMyView::IsMouseOnCloseButton()
{
BOOL bStat = FALSE;

    if ( IsWindowVisible() )
    {
    CWnd* pFrameWnd;
    POINT point;

        // note: By the time we get here the LMB is no longer down.
        // TRACE( "In CDockTabsView::MouseOnCloseButton() and IsLButtonDown(): %d\n", IsLButtonDown() );

            // Was the click on the Output Window Frame (ie. Title Bar)
        GetCursorPos( &point );
        if ( ( pFrameWnd = WindowFromPoint( point ) )->IsChild( this ) )
        {
                // Can't call pFrameWnd ->OnNcHitTest( point ) as its protected so use WM_NCHITTEST
            UINT nHitPos = pFrameWnd->SendMessage( WM_NCHITTEST, 0, MAKELPARAM( point.x, point.y ) );
            // TRACE( "In CDockTabsView::MouseOnCloseButton() and Click in Parent of CDockTabsView: %x, NcHitTest: %x\n", m_hWnd, nHitPos );
            bStat = nHitPos == HTCLOSE;    // Over 'Close Button'
        }
    }
    return bStat;
}


Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
GeneralRe: perform action on close [X] button Pin
*Dreamz28-Jun-04 18:33
*Dreamz28-Jun-04 18:33 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 9:01
elephantstar29-Jun-04 9:01 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 13:37
Neville Franks29-Jun-04 13:37 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 14:56
elephantstar29-Jun-04 14:56 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 15:06
Neville Franks29-Jun-04 15:06 
GeneralRe: perform action on close [X] button Pin
David Crow1-Jul-04 2:21
David Crow1-Jul-04 2:21 
GeneralRe: perform action on close [X] button Pin
elephantstar1-Jul-04 5:55
elephantstar1-Jul-04 5:55 
GeneralRe: perform action on close [X] button Pin
David Crow1-Jul-04 8:05
David Crow1-Jul-04 8:05 
GeneralHELP ME IN THIS PROBLEM Pin
Abo_Osama28-Jun-04 5:44
Abo_Osama28-Jun-04 5:44 
GeneralProblems with Com-Addin Pin
Slowhand0128-Jun-04 5:29
Slowhand0128-Jun-04 5:29 
GeneralRe: Problems with Com-Addin Pin
Anthony_Yio28-Jun-04 17:56
Anthony_Yio28-Jun-04 17:56 
Generaltried to hide a window but the menu bar and tool bar is still shown Pin
Zhang Ming Htmlab28-Jun-04 5:23
Zhang Ming Htmlab28-Jun-04 5:23 
GeneralRe: tried to hide a window but the menu bar and tool bar is still shown Pin
Johan Rosengren28-Jun-04 9:40
Johan Rosengren28-Jun-04 9:40 
GeneralRe: tried to hide a window but the menu bar and tool bar is still shown Pin
Zhang Ming Htmlab29-Jun-04 6:02
Zhang Ming Htmlab29-Jun-04 6:02 
GeneralLoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 5:20
Chris Ulliott28-Jun-04 5:20 
GeneralRe: LoadLibrary Fails :( Pin
User 665828-Jun-04 5:48
User 665828-Jun-04 5:48 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 5:51
Chris Ulliott28-Jun-04 5:51 

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.