Category : Windows 3.X Files
Archive   : SNDHACK.ZIP
Filename : INIT.C

 
Output of file : INIT.C contained in archive : SNDHACK.ZIP
#include
#include
#include
#include "app.h"

/*
* Module: init.c
*
* Contains: Application and instance initialization
* functions.
*
*/


/*********************************************************************/
/* Local Function Prototypes */
/*********************************************************************/


/*********************************************************************/
/* Local data and structures */
/*********************************************************************/


/*********************************************************************/
/* Global functions */
/*********************************************************************/

/*-------------------------------------------------------------------*/
/* Initialize the application for only the first time its executed */
/*-------------------------------------------------------------------*/
BOOL InitApplication(hInstance)
HANDLE hInstance;
{
WNDCLASS AppClass;

AppClass.style = NULL;
AppClass.lpfnWndProc = WinProc;
AppClass.cbClsExtra = 0;
AppClass.cbWndExtra = 0;
AppClass.hInstance = hInstance;
AppClass.hIcon = LoadIcon(hInstance, "ClassIcon");
AppClass.hCursor = LoadCursor(NULL,IDC_ARROW);
AppClass.hbrBackground = GetStockObject(WHITE_BRUSH);
AppClass.lpszMenuName = (LPSTR)"ClassMenu";
AppClass.lpszClassName = (LPSTR)ClassName;

return (RegisterClass(&AppClass));
}

/*-------------------------------------------------------------------*/
/* Initialize the instance, done everytime its executed */
/*-------------------------------------------------------------------*/

BOOL InitInstance(hInstance,nCmdShow)
HANDLE hInstance;
int nCmdShow;
{
RECT Rect;
char *HelpFilePtr;
int i;

hAccelTable = LoadAccelerators(hInstance, (LPSTR)"ClassAccel");

hWindow = CreateWindow(
(LPSTR)ClassName,
(LPSTR)WindowName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
(HWND)NULL,
(HMENU)NULL,
(HANDLE)hInstance,
(LPSTR)NULL);

if (hWindow == NULL) {
MessageBox(
GetFocus(),
(LPSTR)"Could not create the Instance Class Window",
(LPSTR)"CreateWindow Fatal Error",
MB_ICONSTOP);
return FALSE;
}

hInst = hInstance;
hMenu = GetMenu(hWindow);

GetClientRect(hWindow, (LPRECT) &Rect);

hEditWindow = CreateWindow(
"Edit",
NULL,
WS_CHILD | WS_VISIBLE |
ES_MULTILINE |
WS_VSCROLL | WS_HSCROLL |
ES_AUTOHSCROLL | ES_AUTOVSCROLL,
0,
0,
(Rect.right-Rect.left),
(Rect.bottom-Rect.top),
hWindow,
IDC_EDIT, /* Child control i.d. */
hInst,
NULL);

if (!hEditWindow) {
DestroyWindow(hWindow);
MessageBox(
GetFocus(),
(LPSTR)"Could not create the Edit Window",
(LPSTR)"CreateWindow Fatal Error",
MB_ICONSTOP);
return FALSE;
}

i = GetModuleFileName(hInst,HelpFileName,sizeof(HelpFileName)-1);
for (; i > 0; i--) {
if (HelpFileName[i] == '\\' || HelpFileName[i] == ':') {
HelpFileName[i+1] = '\0';
break;
}
}

if (i + 13 < sizeof(HelpFileName))
strcat(HelpFileName, "sndhack.hlp");
else
strcpy(HelpFileName, "sndhack.hlp");

hHourGlass = LoadCursor(NULL, IDC_WAIT);
hNote = LoadCursor(hInstance, "NoteCursor");
ShowWindow(hWindow, nCmdShow);
UpdateWindow(hWindow);

return TRUE;
}


/**********************************************************************/
/* Local functions */
/**********************************************************************/



  3 Responses to “Category : Windows 3.X Files
Archive   : SNDHACK.ZIP
Filename : INIT.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/