Category : C Source Code
Archive   : DLPHONE.ZIP
Filename : PHONLIS.C

 
Output of file : PHONLIS.C contained in archive : DLPHONE.ZIP
/* phonlis.c - Contains main window of application and calls into DLL */
/* Copyright (C) 1988 Michael Draganza */

#include
#include
#include "phonlis.h"

int pascal WinMain(HANDLE, HANDLE, LPSTR, int);
BOOL near Init(HANDLE);
long far pascal ScreenWndProc(HWND, unsigned, WORD, LONG);

extern void far pascal initscreen(HWND);
BOOL far pascal addlist(LPSTR);
extern void far pascal listactive();
extern void far pascal listresize(HWND, LONG);
extern void far pascal msbdown(HWND, LONG);
extern void far pascal msbup(HWND);
extern void far pascal process_scroll(HWND, WORD, LONG);
extern void far pascal listpaint(HWND);
extern void menucmnds();

HANDLE hInst;
HWND hWndmain;

char names[][NAMLEN] = {
"APPLESEED, JOHN 818-489-6819 ", "BAKER, STEVE 599-6819 ",
"CATT, AL 619-555-9768 ", "DANIELS, RICHARD 714-678-5478 ",
"EVANS, M. 818-363-6833 ", "FRUMP, LOUIS 818-522-2822 ",
"GOAT, P. 492-4822 ", "HIGGINS, NANCY 544-6844 ",
"INDIGO, I. 714-882-6822 ", "JONES, S. 213-878-9787 ",
"KARMA, BOB 714-599-622 ", "LEWIS, WILLIAM 529-6001 ",
"MARX, G. 987-8441 ", "NUSSBAUM, OSCAR 714-456-2357 ",
"OYSTER, FRED 987-6288 ", "POTTS, PETER 818-465-3545 ",
"QUE, SUSIE 818-592-3822 ", "ROBERTS, R. 544-6789 ",
"SMITH, E. 213-687-9877 ", "TWEEDLE, FRANK 213-567-4567 ",
"USER, JOE 619-456-8765 ", "VIP, ALLEN 408-567-2725 ",
"WALTERS, PETE 522-5467 ", "XENON, TED 415-592-0457 ",
"YATES, ED 492-4576 ", "ZOG, R. 213-568-2901 "};

/****************************************************************************
Main window routine. Calls initialization function, processes message loop.
/****************************************************************************/

int pascal WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

if (!hPrevInstance)
if (!Init(hInstance))
return (NULL);

hWndmain = CreateWindow("phonelist",
"PhoneList",
WS_OVERLAPPEDWINDOW | WS_HSCROLL,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);

hInst = hInstance;
ShowWindow(hWndmain, nCmdShow);
UpdateWindow(hWndmain);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

BOOL near Init(HANDLE hInstance)
{
WNDCLASS WndClass;

WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
WndClass.lpfnWndProc = ScreenWndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(hInstance, "myicon");
WndClass.lpszMenuName = "appmenu";
WndClass.lpszClassName = "phonelist";
WndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
WndClass.hInstance = hInstance;
if (!RegisterClass(&WndClass))
return FALSE;
}

/***********************************************************************
The windows function for phone directory application main window
/**********************************************************************/
long far pascal ScreenWndProc(HWND hWnd, unsigned message, WORD wParam,
LONG lParam)
{
register int i;
switch (message) {
case WM_COMMAND:
menucmnds(hWnd, wParam);
break;

case WM_CREATE:
initscreen(hWnd);
/* Construct the list of names initially */
for (i=0; i<26; i++)
addlist((LPSTR)names[i]);
break;

case WM_ACTIVATEAPP:
listactive();
break;

case WM_ACTIVATE:
SetFocus(hWnd);
break;

case WM_SIZE:
listresize(hWnd, lParam);
break;

case WM_LBUTTONDOWN:
msbdown(hWnd, lParam);
break;

case WM_LBUTTONUP:
msbup(hWnd);
break;

case WM_PAINT:
listpaint(hWnd);
break;

case WM_HSCROLL:
process_scroll(hWnd, wParam, lParam);
break;

case WM_DESTROY:
PostQuitMessage(0);
break;

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


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