winapp.h

来自「Windows CE .Net 下面 DIRECT SOUND编程的经典实例。对」· C头文件 代码 · 共 83 行

H
83
字号
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//

//==========================================================================;
//
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
//  PURPOSE.
//
//
//--------------------------------------------------------------------------;

#pragma once
#ifndef __WINAPP_H__
#define __WINAPP_H__

class CWindowsModule
{
public:
    static CWindowsModule& GetWinModule();
    static CWindowsModule* GetWinModulePtr();

    CWindowsModule();
    virtual ~CWindowsModule();

    virtual bool Initialize();
    virtual void Shutdown();

#   ifdef UNDER_CE
    typedef LPWSTR command_line_type;
#   else
    typedef LPSTR command_line_type;
#   endif

    const HINSTANCE m_hInstance;

    const command_line_type m_pszCommandLine;
    HWND m_hWnd;
    LPCTSTR m_pszModuleName;
    INT m_iAppReturnCode;

protected:
    virtual bool InitConsoleOutput();

    virtual bool RegisterWindowClass();
    virtual void UnregisterWindowClass();

    virtual bool CreateMainWindow();
    virtual void DestroyMainWindow();

    WNDCLASS m_WindowClass;

public:
    static BOOL DllMain(HANDLE hInstance, ULONG dwReason, LPVOID lpReserved);
};

class CWindowsApplication : public CWindowsModule
{
public:
    static CWindowsApplication& GetWinApp();
    static CWindowsApplication* GetWinAppPtr();

    CWindowsApplication();
    virtual ~CWindowsApplication();

    virtual void Run() = 0; 
    virtual void Shutdown();

public:
    static int WinMain(HINSTANCE hInstance, HINSTANCE, command_line_type pszCmdLine, int);
};


#endif

⌨️ 快捷键说明

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