Category : C Source Code
Archive   : DLLSKEL.ZIP
Filename : MAINWND.C

 
Output of file : MAINWND.C contained in archive : DLLSKEL.ZIP
// -----------------------------------------------------------------
// File name: MAINWND.C
//
// This file contains the application's main window procedure, which
// responds to input to the application's main window.
//
// Description of functions:
//
// MainWndProc - Responds to input to the application's main
// window
// DoCommands - Processes WM_COMMAND messages sent to the
// application's main window
//
// Development Team: Dan Ruder
//
// Written by Microsoft Product Support Services, Windows Developer Support.
//
// Copyright (c) 1991 Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------


#include
#include "globals.h"
#include "about.h"
#include "mainwnd.h"
#include "dllskel.h"

// Local function prototypes.

LRESULT DoCommands (HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam);


//-----------------------------------------------------------------------
// Function: MainWndProc
//
// Purpose : Message handler for main, overlapped window.
//
// Parms : hWnd == Handle to _this_ window
// message == Message to process
// wParam == WORD parameter -- depends on message
// lParam == LONG parameter -- depends on message
//
// Returns : Depends on message.
//-----------------------------------------------------------------------

LRESULT CALLBACK MainWndProc (HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
// Dispatch WM_COMMAND messages to our command handler, DoCommands().

case WM_COMMAND:
return (DoCommands (hWnd, message, wParam, lParam));


// On WM_DESTROY, terminate this app by posting a WM_QUIT message.

case WM_DESTROY:
PostQuitMessage (0);
break;


// We didn't handle, pass to DefWindowProc.

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

return (NULL);
}


//-----------------------------------------------------------------------
// Function: DoCommands
//
// Purpose : Called by MainWndProc() to handle all WM_COMMAND type
// messages.
//
// Parms : hWnd == Handle to _this_ window
// message == Message to process
// wParam == WORD parameter -- depends on message
// lParam == LONG parameter -- depends on message
//
// Returns : Depends on message.
//-----------------------------------------------------------------------

LRESULT DoCommands (HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
switch (wParam)
{
// Put up the About box.

case IDM_ABOUT:
{
FARPROC lpDlgProc;

lpDlgProc = MakeProcInstance (AboutDlg, ghInst);

DialogBox (ghInst, // current instance
AboutBoxName, // resource to use
hWnd, // parent handle
lpDlgProc); // About() instance address

FreeProcInstance (lpDlgProc);
break;
}


// User picked File.C Function. Call a user-defined function.

case IDM_CFUNC:
CCallFunc();

break;


// User picked File.Pascal Function. Call a user-defined function.

case IDM_PASCALFUNC:
PascalCallFunc();

break;


// User picked File.Exit, terminate this app.

case IDM_EXIT:
DestroyWindow (hWnd);
break;


// Must be some system command -- pass it on to the default
// window procedure.

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

return (NULL);
}


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