home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
mag&info
/
msjv7_6.zip
/
TOPTEN.ARJ
/
MOUSEEAT.ARJ
/
MOUSEEAT.C
< prev
next >
Wrap
Text File
|
1992-10-01
|
9KB
|
273 lines
#include <windows.h>
#include "mouseeat.h"
#include "basedefs.h"
/**************************************************************
* *
* Function Prototypes *
* *
**************************************************************/
WINPROC WndProc ( WINDOWS_PARAMS );
WINPROC InvisoWndProc ( WINDOWS_PARAMS );
DLGPROC DlgProc ( DIALOG_PARAMS );
HWND hCreateInvisoWindow ( HWND hParent );
/**************************************************************
* *
* Global Variables *
* *
**************************************************************/
HANDLE ghInst;
HWND ghWnd;
char szAppName[] = "MOUSEEAT";
char szInvisoName[] = "INVISOWINDOW";
/**************************************************************
* *
* WinMain *
* *
**************************************************************/
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
{
MSG msg ;
WNDCLASS wndclass ;
if (!hPrevInstance)
{
// Register Parent Window
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT;
wndclass.lpfnWndProc = (WNDPROC)WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = GetStockObject ( GRAY_BRUSH ) ;
wndclass.lpszMenuName = (LPSTR)"PlainMenu" ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
return FALSE;
// Register the message eater
wndclass.style = NULL;
wndclass.lpfnWndProc = (WNDPROC)InvisoWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_WAIT) ;
wndclass.hbrBackground = GetStockObject ( NULL_BRUSH ) ;
wndclass.lpszMenuName = (LPSTR)NULL;
wndclass.lpszClassName = szInvisoName ;
if (!RegisterClass (&wndclass))
return FALSE;
}
ghInst = hInstance;
ghWnd = CreateWindow (szAppName, "Tiny Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL, NULL, hInstance, NULL) ;
ShowWindow ( ghWnd, nCmdShow );
UpdateWindow ( ghWnd );
while (GetMessage((LPMSG)&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam ;
}
/*********************************************************************
* *
* ModalDialog: Calls a Modal Dialog Box *
* *
*********************************************************************/
int ModalDialog ( LPSTR TemplateName, FARPROC FunctionName, LONG dwParam )
{
FARPROC lpDialogProc;
int RetVal;
lpDialogProc = MakeProcInstance ( FunctionName, ghInst );
RetVal = DialogBoxParam ( ghInst, TemplateName, ghWnd,
lpDialogProc, (DWORD)dwParam );
FreeProcInstance ( lpDialogProc );
return RetVal;
}
/*********************************************************************
* *
* WndProc: Main Message Translator *
* *
*********************************************************************/
WINPROC WndProc ( WINDOWS_PARAMS )
{
switch ( msg )
{
case WM_DESTROY :
PostQuitMessage (0) ;
break ;
case WM_COMMAND :
switch ( wParam )
{
case IDM_MODAL :
ModalDialog ( "MODALDIALOG", DlgProc, 0L );
break;
default:
return DefWindowProc ( hWnd, msg, wParam, lParam ) ;
break;
}
break;
default :
return DefWindowProc ( hWnd, msg, wParam, lParam );
}
return 0L ;
}
/*********************************************************************
* *
* InvisoWndProc: A message eater *
*