编程语言

img huyoo

封装WinApp

发表于2004/10/10 1:36:00  1925人阅读

分类: C Family

/*
  Name: WinApp.h
  Copyright: (c) huyoo,changsha,hunan province,china
  Author: huyoo
  Date: 10-10-04 01:28
  Description: 封装Application
*/

//07-10-04 11:39
#if !defined APP_H
#define APP_H

#include <windows.h>
#include "resource.h"

class WinApp
{
    public:
        WinApp();   
        int InitInstance(HINSTANCE appInstance, HINSTANCE hPrevInst,
                                char * cmdParam, int cmdShow);
       
    public:
        static LRESULT CALLBACK MainWndProc
            (HWND hwnd, UINT message,WPARAM wParam, LPARAM lParam);
};

#endif

//-----------------------------------------------------------
/*
  Name: WinApp.cpp
  Copyright: (c) huyoo,changsha,hunan province,china
  Author: huyoo
  Date: 10-10-04 01:28
  Description: 封装Application
*/
#include "WinApp.h"
#include <windows.h>
WinApp::WinApp()
{}

int WinApp::InitInstance(HINSTANCE appInstance, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
     return 0;
}   

LRESULT CALLBACK WinApp::MainWndProc
    (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

    switch (message)
    {
    case WM_CREATE:
        return 0;

    case WM_SIZE:
        return 0;
    case WM_PAINT:

        return 0;
    case WM_COMMAND:

        return 0;
    
    }
    return ::DefWindowProc (hwnd, message, wParam, lParam);
}
//------------------------------------------------------------------------------- 
//main.cpp
#include "winapp.h"
int WINAPI WinMain
    (HINSTANCE appInstance, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
    WinApp theApp;
    return theApp.InitInstance(appInstance, hPrevInst,  cmdParam, cmdShow);
}

//千万不要去调试运行,没有任何结果.
//仅仅当作抛砖引玉了  !!!              ^_*

阅读全文
0 0

相关文章推荐

img
取 消
img