home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
progjour
/
1991
/
02
/
jpi
/
min.c
< prev
next >
Wrap
Text File
|
1990-12-20
|
3KB
|
89 lines
/*-------------------------------------------------------------*\
| MIN.C A Minimum Windows Program that displays a window. |
| The window can be moved, sized, minimized and |
| maximized. The WM_QUIT message is correctly |
| handled so that the program terminates properly. |
\*-------------------------------------------------------------*/
#pragma warn(wall => on)
#pragma warn(wpnu => off)
#include <Windows.H>
/*-------------------------------------------------------------*\
| Function Prototypes. |
\*-------------------------------------------------------------*/
#pragma save
#pragma call( windows => on )
long FAR PASCAL MinWndProc (HWND, WORD, WORD, LONG);
#pragma restore
/*-------------------------------------------------------------*\
| Main Function: WinMain. |
\*-------------------------------------------------------------*/
int PASCAL WinMain (HANDLE hInstance,
HANDLE hPrevInstance,
LPSTR lpszCmdLine,
int cmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if (!hPrevInstance)
{
wndclass.lpszClassName = (LPSTR)"MIN:MAIN";
wndclass.hInstance = hInstance;
wndclass.lpfnWndProc = MinWndProc;
wndclass.hCursor = LoadCursor (hInstance, (LPSTR)"hand");
wndclass.hIcon = LoadIcon (hInstance,(LPSTR)"snapshot");
wndclass.lpszMenuName = NULL;
wndclass.hbrBackground = COLOR_WINDOW+1;
wndclass.style = NULL;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
RegisterClass( (LPWNDCLASS)&wndclass);
}
hwnd = CreateWindow((LPSTR)"MIN:MAIN", /* Class name. */
(LPSTR)"Minimum", /* Title. */
WS_OVERLAPPEDWINDOW, /* Style bits. */
CW_USEDEFAULT, /* x - default. */
0, /* y - default. */
CW_USEDEFAULT, /* cx - default. */
0, /* cy - default. */
NULL, /* No parent. */
NULL, /* Class menu. */
hInstance, /* Creator. */
NULL); /* Params. */
ShowWindow (hwnd, cmdShow);
while (GetMessage((LPMSG)&msg, 0, 0, 0))
{
TranslateMessage((LPMSG)&msg); /* Keyboard input. */
DispatchMessage((LPMSG)&msg);
}
return 0;
}
/*-------------------------------------------------------------*\
| Window Procedure: MinWndProc. |
\*-------------------------------------------------------------*/
long FAR PASCAL MinWndProc (HWND hwnd, WORD wMsg,
WORD wParam, LONG lParam)
{
switch (wMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hwnd,wMsg,wParam,lParam));
break;
}
return 0L;
}