⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subclasswnd.cpp

📁 TabBars的开源源码
💻 CPP
字号:
/***************************************************************************/
/* NOTE:                                                                   */
/* This document is copyright (c) by Oz Solomonovich.  All non-commercial  */
/* use is allowed, as long as this document not altered in any way, and    */
/* due credit is given.                                                    */
/***************************************************************************/

// SubclassWnd.cpp : implementation file
//
// This is the base class for all subclassed windows.  It gives subclassed
// windows the ability to temporarily unsubclass themselves.

//this line was inserted and notified to you
//I remove some function or porpert which this addin do not use
//it cound not be replaced by original file

#include "stdafx.h"
#include "TabBars.h"
#include "SubclassWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSubclassWnd

CSubclassWnd::CSubclassWnd(HWND hWndSubclass) : 
    m_Saved_hWnd(hWndSubclass), m_bIsSubclassed(false)
{
}

CSubclassWnd::~CSubclassWnd()
{
    DoUnsubclass();
}


BEGIN_MESSAGE_MAP(CSubclassWnd, CWnd)
	//{{AFX_MSG_MAP(CSubclassWnd)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CSubclassWnd message handlers


/////////////////////////////////////////////////////////////////////////////
// CSubclassWnd operations

void CSubclassWnd::DoUnsubclass()
{
    // work-around for embedded windows:
    // if you open an external document (such as a WinWord file), WinWord
    // will destroy the window but our m_hWnd won't be updated
    if (!::IsWindow(m_hWnd))
    {
        m_hWnd = NULL;
        m_bIsSubclassed = false;
        return;
    }

    if (m_hWnd  &&  m_bIsSubclassed)
    {
        if (::GetWindowLong(m_hWnd, GWL_WNDPROC) == (LONG)AfxGetAfxWndProc())
        {
            UnsubclassWindow();
        }
        else
        {
            TRACE("TabBars: Trying to unsubclass a window that was "
                  "subclassed by someone else.\n");

            // someone subclassed after us (very bad!) - we'll just detach,
            // hope for the best, and keep on going...
            Detach();
        }
        m_bIsSubclassed = false;
    }
}

void CSubclassWnd::DoSubclass(HWND hWndSubclass /*=NULL*/)
{
    if (hWndSubclass)
    {
        m_Saved_hWnd = hWndSubclass;
    }

    if (m_Saved_hWnd  &&  !m_bIsSubclassed)
    {
        SubclassWindow(m_Saved_hWnd);
        m_bIsSubclassed = true;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -