1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include <windows.h>
HINSTANCE hInst;
char szIndicatorWindowClass[]= "IndicatorWindow1";
char szTitleIndicatorWindow[]= "I will eat your RAM";
LRESULT CALLBACK WndProcIndicatorWindow(HWND, UINT, WPARAM, LPARAM);
int APIENTRY IndicatorWindow(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,int nCmdShow);
int WINAPI WinMain( HINSTANCE hModule, HINSTANCE unused,
PSTR cmd, int show )
{ hInst=hModule;
IndicatorWindow(hModule,0,0,show);
return TRUE;
}
HWND hWindowMain;
int APIENTRY IndicatorWindow( HINSTANCE hInstance,
HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
{ MSG msg;
WNDCLASSEX wcex={sizeof(wcex)};// set first member, zero the rest
wcex.style = CS_HREDRAW|CS_VREDRAW;
wcex.lpfnWndProc = WndProcIndicatorWindow;
wcex.hInstance = hInstance;
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = szIndicatorWindowClass;
wcex.lpszClassName = szIndicatorWindowClass;
RegisterClassEx( &wcex );
hWindowMain = CreateWindow(szIndicatorWindowClass, szTitleIndicatorWindow,
WS_OVERLAPPEDWINDOW, 50, 50, 100,
100, NULL, NULL, hInstance, NULL);
if (!hWindowMain)
{ return FALSE;
}
ShowWindow(hWindowMain, nCmdShow);
UpdateWindow(hWindowMain);
::SendMessage(hWindowMain,WM_PAINT,0,0);
while (GetMessage(&msg, NULL, 0, 0))
{ TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
LRESULT CALLBACK WndProcIndicatorWindow(HWND hWnd,
UINT message, WPARAM wParam, LPARAM lParam)
{ switch (message)
{
case WM_CREATE:
break;
case WM_CTLCOLORSTATIC:
break;
case WM_SIZING:
break;
case WM_PAINT:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
|