|
From: EviLToYLeT <evi...@us...> - 2004-08-28 19:13:46
|
Update of /cvsroot/notepro/pete-current/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441/src Modified Files: main.cpp Log Message: Index: main.cpp =================================================================== RCS file: /cvsroot/notepro/pete-current/src/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 28 Aug 2004 18:38:15 -0000 1.1 --- main.cpp 28 Aug 2004 19:13:37 -0000 1.2 *************** *** 1,16 **** ! #include <windows.h> //include the windows header files ! #define WIN32_LEAN_AND_MEAN //reduce unnecessary windows controls ! LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); //Program entrance point INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ ! MessageBox(0,"Let's get this show on the road!", "Testing this",0); } ! LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch(msg){ ! default: ! return DefWindowProc(hwnd,msg,wParam,lParam); } } --- 1,65 ---- ! #include <windows.h> //include the windows header files ! #define WIN32_LEAN_AND_MEAN //reduce unnecessary windows controls ! //Window callback procedure ! LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); //Program entrance point INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ ! static TCHAR szAppName[] = "PETE"; //Application name ! HWND hWnd; //Handle to main window ! WNDCLASSEX wc; //Default window class ! MSG msg; //Procedure messages ! ! ZeroMemory(&wc,sizeof(WNDCLASSEX)); //Clear the window structure ! ! //Setting up our window structure ! wc.cbClsExtra = 0; ! wc.cbSize = sizeof(WNDCLASSEX); ! wc.cbWndExtra = 0; ! wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); ! wc.hCursor = NULL; ! wc.hIcon = NULL; ! wc.hIconSm = NULL; ! wc.hInstance = hInstance; ! wc.lpfnWndProc = WndProc; ! wc.lpszClassName = szAppName; ! wc.lpszMenuName = NULL; ! wc.style = CS_HREDRAW|CS_VREDRAW; ! ! //Regsiter the window class ! if(!RegisterClassEx(&wc)){ ! MessageBox(0,"Error registering the window","Fatal Error", MB_ICONERROR); ! } ! ! //Create the window ! hWnd = CreateWindow(szAppName,szAppName,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ! if(!hWnd){ ! MessageBox(0,"Error creating the window", "Fatal Error", MB_ICONERROR); ! } ! ! //Display and update the window ! ShowWindow(hWnd,nShowCmd); ! UpdateWindow(hWnd); ! ! //Enter the message pump ! while(GetMessage(&msg,NULL,0,0)){ ! TranslateMessage(&msg); ! DispatchMessage(&msg); ! } ! return msg.wParam; } ! LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch(msg){ ! case WM_CREATE: ! MessageBox(hWnd, "hello", "hello", 0); ! break; ! case WM_DESTROY: ! PostQuitMessage(0); ! return 0; ! break; } + //Let windows handle the processing + return DefWindowProc(hWnd,msg,wParam,lParam); } |