D
djuro.tost
#include <windows.h>
LONG FAR PASCAL WndProc(HWND,UINT,WPARAM,LPARAM);
char szProgName[]="ProgName";
// Remove next line for Microsoft C++ compile
//#pragma argsused
int PASCAL WinMain(HINSTANCE hInst,HINSTANCE hPreInst,
LPSTR lpszCmdLine,int nCmdShow)
{
HWND hWnd;
MSG lpMsg;
WNDCLASS wcApp;
if (!hPreInst) {
wcApp.lpszClassName=szProgName;
wcApp.hInstance =hInst;
wcApp.lpfnWndProc =WndProc;
wcApp.hCursor =LoadCursor(NULL,IDC_ARROW);
wcApp.hIcon =NULL;
wcApp.lpszMenuName =NULL;
//wcApp.hbrBackground=GetStockObject(WHITE_BRUSH);
wcApp.style =CS_HREDRAW|CS_VREDRAW;
wcApp.cbClsExtra =0;
wcApp.cbWndExtra =0;
if (!RegisterClass (&wcApp))
return FALSE;
}
hWnd=CreateWindow(szProgName,"Simple Windows Application",
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,(HWND)NULL,(HMENU)NULL,
(HANDLE)hInst,(LPSTR)NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&lpMsg,NULL,NULL,NULL)) {
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
}
return(lpMsg.wParam);
}
LONG FAR PASCAL WndProc(HWND hWnd,UINT messg,
WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch (messg)
{
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
//--------- your routines below ---------
//--------- your routines above ---------
ValidateRect(hWnd,NULL);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd,messg,wParam,lParam));
}
return(0L);
}
LONG FAR PASCAL WndProc(HWND,UINT,WPARAM,LPARAM);
char szProgName[]="ProgName";
// Remove next line for Microsoft C++ compile
//#pragma argsused
int PASCAL WinMain(HINSTANCE hInst,HINSTANCE hPreInst,
LPSTR lpszCmdLine,int nCmdShow)
{
HWND hWnd;
MSG lpMsg;
WNDCLASS wcApp;
if (!hPreInst) {
wcApp.lpszClassName=szProgName;
wcApp.hInstance =hInst;
wcApp.lpfnWndProc =WndProc;
wcApp.hCursor =LoadCursor(NULL,IDC_ARROW);
wcApp.hIcon =NULL;
wcApp.lpszMenuName =NULL;
//wcApp.hbrBackground=GetStockObject(WHITE_BRUSH);
wcApp.style =CS_HREDRAW|CS_VREDRAW;
wcApp.cbClsExtra =0;
wcApp.cbWndExtra =0;
if (!RegisterClass (&wcApp))
return FALSE;
}
hWnd=CreateWindow(szProgName,"Simple Windows Application",
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,(HWND)NULL,(HMENU)NULL,
(HANDLE)hInst,(LPSTR)NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&lpMsg,NULL,NULL,NULL)) {
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
}
return(lpMsg.wParam);
}
LONG FAR PASCAL WndProc(HWND hWnd,UINT messg,
WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch (messg)
{
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
//--------- your routines below ---------
//--------- your routines above ---------
ValidateRect(hWnd,NULL);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd,messg,wParam,lParam));
}
return(0L);
}