Category : C Source Code
Archive   : TERMWAIT.ZIP
Filename : TERMWAIT.C

 
Output of file : TERMWAIT.C contained in archive : TERMWAIT.ZIP
//****************************************************************************
// File: termwait.c
//
// Purpose: Contains main message loop, application entry point and intialization functions
//
// Functions:
// WinMain() - initializes everything and enters message loop
// InitApplication() - registers the window class for first instance of app
// InitInstance() - creates and displays main window
//
//
// Development Team:
// Vinoo Cherian
//
// Written by Microsoft Product Support Services, Windows Developer Support
// Copyright (c) 1992 Microsoft Corporation. All rights reserved.
//****************************************************************************

#include
#include
#include "termwait.h"

// Local function prototypes.
int PASCAL WinMain (HINSTANCE, HINSTANCE, LPSTR, int);
BOOL InitApplication (HINSTANCE);
BOOL InitInstance (HINSTANCE, int);

//Globals

HINSTANCE ghInst;
HWND ghwnd;
char szWndClassName[STR_LEN];
char szTitle[STR_LEN];
char szMenuName[STR_LEN];
char szIconName[STR_LEN];


//***********************************************************************
// Function: WinMain
//
// Purpose: Called by Windows on app startup. Initializes everything,
// and enters a message loop.
//
// Parameters:
// hInstance == Handle to _this_ instance.
// hPrevInstance == Handle to last instance of app.
// lpCmdLine == Command Line passed into app.
// nCmdShow == How app should come up (i.e. minimized/normal)
//
// Returns: Return value from PostQuitMessage.
//
// Comments:
//
// History: Date Author Reason
// 4/17/92 Vinoo Cherian Created
//****************************************************************************

int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

LoadString(hInstance, IDS_WNDCLASSNAME, szWndClassName, STR_LEN);
LoadString(hInstance, IDS_PROGNAME, szTitle, STR_LEN);
LoadString(hInstance, IDS_MAINMENUNAME, szMenuName, STR_LEN);
LoadString(hInstance, IDS_ICONNAME, szIconName, STR_LEN);

if (!hPrevInstance)
if (!InitApplication(hInstance))
return (FALSE);

if (!InitInstance(hInstance, nCmdShow))
return (FALSE);

while (GetMessage(&msg, NULL, NULL, NULL))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

// If the child task is still executing and this application
// has been terminated, restore the default notification handler
if (bChildIsExecuting)
NotifyUnRegister(NULL);

return (msg.wParam); // Returns the value from PostQuitMessage
}

//****************************************************************************
// Function: InitApplication
//
// Purpose: Called by WinMain on first instance of app. Registers
// the window class.
//
// Parameters:
// hInstance == Handle to _this_ instance.
//
// Returns: TRUE on success, FALSE otherwise.
//
// Comments:
//
// History: Date Author Reason
// 4/17/92 Vinoo Cherian Created
//****************************************************************************

BOOL InitApplication (HINSTANCE hInstance)
{
WNDCLASS wc;


wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, szIconName);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = COLOR_WINDOW + 1;
wc.lpszMenuName = szMenuName;
wc.lpszClassName = szWndClassName;

return RegisterClass(&wc);

}

//****************************************************************************
// Function: InitInstance
//
// Purpose: Called by WinMain on instance startup. Creates and
// displays the main, overlapped window.
//
// Parameters:
// hInstance == Handle to _this_ instance.
// nCmdShow == How app should come up (i.e. minimized/normal)
//
// Returns: TRUE on success, FALSE otherwise.
//
// Comments:
//
// History: Date Author Reason
// 4/17/92 Vinoo Cherian Created
//****************************************************************************

BOOL InitInstance (HINSTANCE hInstance, int nCmdShow)
{

ghInst = hInstance;
// Create Main Window
ghwnd = CreateWindow(szWndClassName, szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
500, 400,
NULL, NULL, hInstance, NULL);
if (!ghwnd)
return FALSE;

ShowWindow(ghwnd, nCmdShow); // Show the window
UpdateWindow(ghwnd); // Sends WM_PAINT message
}


  3 Responses to “Category : C Source Code
Archive   : TERMWAIT.ZIP
Filename : TERMWAIT.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/