#include <afxwin.h>
class MyApp : public CWinApp
{
    public:
        BOOL InitInstance()
        {
              CFrameWnd *Frame = new CFrameWnd(); 
              m_pMainWnd = Frame;                              //繼承CWinThread 類別的m_pMainWnd屬性
            
              Frame->Create(NULL, "Hello Win32");
              Frame->ShowWindow(SW_SHOW);
              return true;
        }


};
MyApp aApp;

 

--------------------------------------------------------------------------------------------------------

1. 滑鼠點選上面CWinApp(反白), 並按右鍵[移至定義]

class CWinApp : public CWinThread

{

....

    // overrides for implementation
    virtual BOOL InitInstance();

}

2. 滑鼠點選CWinThread(反白)按右鍵[移至定義]

class CWinThread : public CCmdTarget

{

    CWnd* m_pMainWnd;       // main window (usually same AfxGetApp()->m_pMainWnd)

}

3. 滑鼠點選CCmdTarget(反白)按右鍵[移至定義]

class AFX_NOVTABLE CCmdTarget : public CObject

{

....

}

---------------------------------------------------------------------------------------------------------

MyApp -> CWinApp -> CWinThread -> CCmdTarget -> CObject

1. 宣告MyApp 繼承 CWinApp類別的InitInstance()

2. 繼承CWinThread 類別的m_pMainWnd屬性

3. Frame->Create()

    CFrameWnd::Create:

    Call to create and initialize the Windows frame window associated with the CFrameWnd object.

4.  Frame->ShowWindow()

5.  Frame->Create(NULL, _T("Hello Win32"), WS_SYSMENU | WS_VSCROLL | WS_HSCROLL | WS_MAXIMIZEBOX | WS_MINIMIZEBOX);

WS_SYSMENU: 右上角出現X

WS_MAXIMIZEBOX: 可最大化

WS_MINIMIZEBOX: 可最小化

WS_VSCROLL: 垂直捲軸

WS_HSCROLL: 水平捲軸

6. Frame->ShowWindow(SW_SHOWMAXIMIZED);

SW_SHOWMAXIMIZED: 視窗開啟後最大化 

arrow
arrow
    全站熱搜

    me1237guy 發表在 痞客邦 留言(0) 人氣()