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

📄 classlib.h

📁 英文版的 想要的话可以下载了 为大家服务
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * CLASSLIB.H
 * Sample Code Class Libraries
 *
 * Master include file for our own Class Library containing:
 *  CStringTable    Class that manages a stringtable.
 *  CHourglass      Class to manage the hourglass.
 *
 *  CWindow         Basic window class for most other classes in here
 *  CToolBar        Wrapper for a toolbar control
 *  CStatusLine     Wrapper for a status lib control
 *
 *  CFrame          Frame window
 *  CClient         Client window with a uniform interface for
 *                  MDI and SDI frames.
 *  CDocument       Document window, also with a uniform interface
 *                  for MDI and SDI.
 *
 *  CDocumentAdviseSink Object implemented in the frame that the
 *                      document notifies of important events.
 *
 * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
 *
 * Kraig Brockschmidt, Microsoft
 * Internet  :  kraigb@microsoft.com
 * Compuserve:  >INTERNET:kraigb@microsoft.com
 */


#ifndef _CLASSLIB_H_
#define _CLASSLIB_H_

#include <book1632.h>

//Get default resource definitions
#include "classres.h"


class CStringTable;
class CHourglass;
class CToolBar;
class CStatusLine;
class CWindow;
class CFrame;
class CClient;
class CDocument;
class CDocumentAdviseSink;
class CHatchWin;


/**
 ** CStringTable providing string table management for anyone.
 **/

class CStringTable
    {
    protected:
        HINSTANCE       m_hInst;
        UINT            m_idsMin;
        UINT            m_idsMax;
        USHORT          m_cStrings;
        LPTSTR          m_pszStrings;
        LPTSTR         *m_ppszTable;

    public:
        CStringTable(HINSTANCE);
        ~CStringTable(void);

        BOOL Init(UINT, UINT);

        //Function to resolve an ID into a string pointer.
        const LPTSTR operator [](const UINT) const;
    };


typedef CStringTable *PCStringTable;

/*
 * Typical classes that initialize a stringtable should have an m_pST
 * member, then they can use this macro conveniently.
 */

#define PSZ(i) ((*m_pST)[i])
#define CCHSTRINGMAX            256


/**
 ** CHourglass:  Manages the hourglass and mouse capture
 **/

class CHourglass
    {
    protected:
        HWND            m_hWndCapture;      //Window with capture
        HCURSOR         m_hCur;             //Cursor held.

    public:
        CHourglass(void);
        CHourglass(HWND);
        ~CHourglass(void);
    };

typedef CHourglass *PCHourglass;



/**
 ** CWindow:  Our basic window class.
 **/

class CWindow
    {
    protected:
        HINSTANCE   m_hInst;            //Task instance
        HWND        m_hWnd;             //Window handle of the window

    public:
        //Standard Class Functions
        CWindow(HINSTANCE);
        ~CWindow(void);

        //Just returns members.  No need to modify
        HWND        Window(void);
        HINSTANCE   Instance(void);
    };


typedef CWindow * PCWindow;




/**
 ** CToolBar encapculates a toolbar control
 **/

#include <bttncur.h>
#include <gizmobar.h>


class CToolBar : public CWindow
    {
    protected:
        UINT            m_cyBar;

    public:
        CToolBar(HINSTANCE);
        ~CToolBar(void);

        BOOL   Init(HWND, UINT, UINT);

        //Window message wrappers
        void   OnSize(HWND);
        void   FontSet(HFONT, BOOL);
        HFONT  FontGet(void);
        void   Enable(BOOL);

        //ToolBar function wrappers
        HWND   HwndAssociateSet(HWND);
        HWND   HwndAssociateGet(void);

        BOOL   Add(UINT, UINT, UINT, UINT, UINT, LPTSTR, HBITMAP
                   , UINT, UINT);
        BOOL   Remove(UINT);

        LONG   SendMessage(UINT, UINT, WPARAM, LPARAM);

        BOOL   Show(UINT, BOOL);
        BOOL   Enable(UINT, BOOL);
        BOOL   Check(UINT, BOOL);
        UINT   FocusSet(UINT);
        BOOL   Exist(UINT);

        int    TypeGet(UINT);

        DWORD  DataSet(UINT, DWORD);
        DWORD  DataGet(UINT);
        BOOL   NotifySet(UINT, BOOL);
        BOOL   NotifyGet(UINT);

        int    TextGet(UINT, LPTSTR, UINT);
        void   TextSet(UINT, LPTSTR);
        UINT   IntGet(UINT, BOOL *, BOOL);
        void   IntSet(UINT, int, BOOL);
    };


typedef CToolBar *PCToolBar;





/**
 ** CStatusLine encapsulates a status line control.
 **/

#include <stastrip.h>


class CStatusLine : public CWindow
    {
    protected:
        UINT        m_cy;           //Control height

    public:
        CStatusLine(HINSTANCE);
        ~CStatusLine(void);

        BOOL  Init(HWND, UINT, UINT);

        void  OnSize(HWND);
        void  MessageSet(LPTSTR);
        UINT  MessageGet(LPTSTR, UINT);
        UINT  MessageGetLength(void);
        void  FontSet(HFONT, BOOL);
        HFONT FontGet(void);
        void  Enable(BOOL);

        BOOL  MessageMap(HWND, HINSTANCE, UINT, UINT, UINT, UINT
                  , UINT, UINT, UINT, UINT, UINT);
        void  MenuSelect(WPARAM, LPARAM);
        void  MessageDisplay(UINT);
    };

typedef CStatusLine *PCStatusLine;





/**
 ** CFrame encapsulates a main application window
 **/

//FRAMEWIN.CPP:  Standard window procedure and AboutProc
LRESULT APIENTRY FrameWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL    APIENTRY AboutProc(HWND, UINT, WPARAM, LPARAM);

#define CBFRAMEWNDEXTRA     sizeof(LONG)
#define FRAMEWL_STRUCTURE   0


/*
 * Structure containing resource ranges for initialization of
 * a CFrame object through its Init member.
 */

typedef struct tagFRAMEINIT
    {
    UINT    idsMin;         //Stringtable start and end
    UINT    idsMax;

    UINT    idsStatMin;     //StatStrip stringtable start and end
    UINT    idsStatMax;

    UINT    idStatMenuMin;  //Start and end IDs for StatStrip
    UINT    idStatMenuMax;  //popup menu IDs

    UINT    iPosWindowMenu; //Position of the Window menu (MDI init)
    UINT    cMenus;         //Number of popup menus we have.

    int     x;              //Window positioning.
    int     y;
    int     cx;
    int     cy;
    } FRAMEINIT, *PFRAMEINIT;



//FRAME.CPP:  Frame object that creates a main window

class CFrame : public CWindow
    {
    //Let our window procedure look in our private variables.
    friend LRESULT APIENTRY FrameWndProc(HWND, UINT, WPARAM, LPARAM);
    friend class CDocumentAdviseSink;

    protected:
        HINSTANCE       m_hInstPrev;        //WinMain parameters
        LPTSTR          m_pszCmdLine;
        int             m_nCmdShow;

        LPTSTR         *m_ppszCmdArgs;      //Command line arguments
        UINT            m_cCmdArgs;
        BOOL            m_fCmdsParsed;      //Been parsed yet?

        BOOL            m_fInit;            //Initializing or closing
        BOOL            m_fSizing;          //Inside WM_SIZE
        BOOL            m_fClosing;         //In WM_CLOSE

        BOOL            m_fLastEnable;      //Toolbar enable state
        BOOL            m_fLastPaste;

        HMENU          *m_phMenu;           //Popup menu handles
        HMENU           m_hMenuWindow;      //"Window" menu

        HACCEL          m_hAccel;           //Accelerators
        HBITMAP         m_hBmp;             //Toolbar images
        UINT            m_cyBar;            //Toolbar height
        UINT            m_dxB;              //Toolbar button sizes
        UINT            m_dyB;

        PCToolBar       m_pTB;              //Toolbar
        PCStatusLine    m_pSL;              //Status line

        PCStringTable   m_pST;              //Stringtable.
        CClient        *m_pCL;              //SDI/MDI client window

    protected:
        virtual BOOL     ParseCommandLine(void);
        virtual CClient *CreateCClient(void);

        virtual BOOL     RegisterAllClasses(void);
        virtual BOOL     PreShowInit(void);
        virtual void     OpenInitialFiles(void);

⌨️ 快捷键说明

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