HelloCE.h
#include "windows.h"
//Function prototypes
int InitApp(HINSTANCE);
HWND InitInstance(HINSTANCE,LPWSTR,int);
int TermInstance(HINSTANCE,int);
//Window procedure
LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM);
//Message handlers
HelloCE.cpp
#include "HelloCE.h"
const TCHAR szAppName[]=TEXT("HelloCE");
HINSTANCE hInst;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,int nShowCmd)
{
MSG msg;
HWND hMainWnd;
if(!InitApp(hInstance))
return 0;
hMainWnd=InitInstance(hInstance,lpCmdLine,nShowCmd);
if(!hMainWnd)
return 0;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return TermInstance(hInstance,msg.wParam);
}
int InitApp(HINSTANCE hInstance)
{
WNDCLASS wc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hCursor=NULL;
wc.hIcon=0;
wc.hInstance=hInstance;
wc.lpszMenuName=NULL;
wc.lpfnWndProc=MainWndProc;
wc.lpszClassName=szAppName;
wc.style=0;
if(!RegisterClass(&wc))
return 0;
return 1;
}
LRESULT CALLBACK MainWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
return 0;
}
HWND InitInstance(HINSTANCE hInstance,LPWSTR lpCmdLine,int nShowCmd)
{
HWND hWnd;
hInst=hInstance;
hWnd=CreateWindow(szAppName,TEXT("helloCE"),WS_VISIBLE,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
if(!IsWindow(hWnd))
return 0;
ShowWindow(hWnd,nShowCmd);
UpdateWindow(hWnd);
return hWnd;
}
int TermInstance(HINSTANCE hInstance,int nEnd)
{
return nEnd;
}
//Copyright reserved by Doug