Category : Windows 3.X Files
Archive   : WINQUE.ZIP
Filename : SYSQUEUE.C

 
Output of file : SYSQUEUE.C contained in archive : WINQUE.ZIP
/* SysQueue.C -- Windows application that displays system load*/
/* by Barry Press, adapted from FreeMem written */
/* by Charles Petzold as printed in Microsoft Systems Journal */

/* Adapted for Graphic Display by Alec Saunders */
/* Graph goes down when load increases and rises when */
/* load decreases */

#include /* all Windows functions */
#include /* ltoa */
#include /* strcat & strlen */


#define MAXCOUNT 25
#define MAXPOLLS 1200

int lLoopCount[MAXCOUNT];

long FAR PASCAL WndProc (HWND, unsigned, WORD, LONG);

/* WinMain - Main loop for all Windows applications */
int PASCAL WinMain ( hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
HANDLE hInstance, hPrevInstance;
LPSTR lpszCmdLine;
int nCmdShow;
{
static char szAppName [] = "SysQueue";
WNDCLASS WndClass;
HWND hWnd;
MSG msg;
int i;

/* allow only one instance */
if (hPrevInstance)
return FALSE;

/* define Window class */
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = NULL;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = szAppName;
WndClass.hbrBackground = GetStockObject( WHITE_BRUSH );
WndClass.hInstance = hInstance;
WndClass.style = CS_VREDRAW | CS_HREDRAW;
WndClass.lpfnWndProc = WndProc;

/* register this new class with WINDOWS */
if (!RegisterClass( &WndClass ))
return FALSE; /* Initialization failed */

/* create window */
hWnd = CreateWindow( szAppName,
szAppName,
WS_TILEDWINDOW,
0, 0, 0, 0,
(HWND) NULL,
(HMENU) NULL,
hInstance,
NULL);

/* set up timer (1 update/sec) */
if (!SetTimer (hWnd, 1, 500, NULL) )
return FALSE;

/* show window (start in ICONIC state) */
ShowWindow( hWnd, SHOW_ICONWINDOW );
UpdateWindow( hWnd );

/* initialize loop count which is bumped in loop */
for(i=0;i ;

/* main program loop */
while (TRUE) {
lLoopCount[MAXCOUNT - 1]--;
if (PeekMessage( &msg, NULL, 0, 0, TRUE )) {
if (msg.message == WM_QUIT)
break;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}

/* exit back to Windows */
return (int) msg.wParam;

} /* end WinMain */

/* WndProc - Window procedure for main window */
long FAR PASCAL WndProc (hWnd, message, wParam, lParam)
HWND hWnd;
unsigned message;
WORD wParam;
LONG lParam;
{
char buffer[MAXCOUNT];
PAINTSTRUCT ps;
RECT rect;
int i;

/* switch on message type sent to window by Windows dispatcher */
switch(message) {

case WM_TIMER:
for (i=0; i<(MAXCOUNT - 1); i++)
lLoopCount[i] = lLoopCount[i+1];
lLoopCount[MAXCOUNT - 1] = MAXPOLLS;
InvalidateRect( hWnd, NULL, TRUE );
break;

case WM_PAINT:
BeginPaint( hWnd, &ps );
GetClientRect( hWnd, &rect );
SetMapMode( ps.hdc, MM_ANISOTROPIC);
SetWindowOrg( ps.hdc, 0, 0);
SetWindowExt( ps.hdc, MAXCOUNT, MAXPOLLS);
SetViewportOrg(ps.hdc, 0, 0);
SetViewportExt(ps.hdc, rect.right - rect.left,
rect.bottom - rect.top);

MoveTo( ps.hdc, 0, lLoopCount[0]);
for (i = 1; i < (MAXCOUNT - 1); i++)
LineTo( ps.hdc, i, lLoopCount[i]);

EndPaint( hWnd, &ps );
break;

case WM_DESTROY:
KillTimer (hWnd, 1);
PostQuitMessage( 0 );
break;

default:
return DefWindowProc( hWnd, message, wParam, lParam);
}

return (long) 0;

} /* end WndProc */


  3 Responses to “Category : Windows 3.X Files
Archive   : WINQUE.ZIP
Filename : SYSQUEUE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/