Category : Files from Magazines
Archive   : WDMAY92.ZIP
Filename : 3N05032A

 
Output of file : 3N05032A contained in archive : WDMAY92.ZIP
#include
#include "windows.h"
/*
******************************************************************
Title: PIPEWIN.C - Windows Component of Pipe Interface
Author: Thomas W. Olsen
Version: 3.0
Compiler: Microsoft C 6.0
cl /AL /Gsw /W3 /Oas /Zpe /Zi /c pipewin.c
cl /AL /Gsw /W3 /Oas /Zpe /Zi /c pipefunc.c
link /CO /NOD pipewin pipefunc ,,, libw llibcew kernel, pipewin.def
rc pipewin.exe
******************************************************************
*/
void FAR PASCAL CallbackProc(HWND hWnd, unsigned message, WORD wParam, LONG lParam);
long FAR PASCAL WindowProc(HWND hWnd, unsigned message, WORD wParam, LONG lParam);
BOOL PASCAL PipeSetup(void);
BOOL PASCAL PipeRegisterCallback(HWND hWnd, FARPROC lpProcPtr);
BOOL PASCAL PipeUnregisterCallback(void);


int PASCAL WinMain(HANDLE hInst, HANDLE hPrevInst, LPSTR lpCmdLine, int numCmdShow )
{
MSG msg;
HWND hWnd;
HDC hContext;
HANDLE selector = 0;
LPSTR lpBuffer = NULL;
WNDCLASS wc;

/************************* Setup Window ************************/

wc.style = NULL;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "PipeClass";

if (!RegisterClass(&wc))
return(FALSE);

hWnd = CreateWindow( "PipeClass", "Windows / DOS Pipe Example",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, NULL, NULL, hInst, NULL );
if (!hWnd)
return (FALSE);

ShowWindow( hWnd, numCmdShow );
hContext = GetDC( hWnd ); /* Need Display Context */

/****************** Call Device & Wait for Messages ***************/

if (PipeSetup() == FALSE)
{
lpBuffer = "Cannot Find Pipe.";
TextOut( hContext, 0, 0, lpBuffer, lstrlen(lpBuffer) );
}
else
PipeRegisterCallback(hWnd, CallbackProc); /* Tell Pipe Who to Call */

ReleaseDC( hWnd, hContext ); /* Free Display Context */
UpdateWindow( hWnd );

while (GetMessage(&msg, NULL, NULL, NULL)) /* Typical Message Loop */
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

/***************** Receives Call From Virtual Device Pipe *************/

void FAR PASCAL CallbackProc(HWND hWnd, unsigned message, WORD wParam, LONG lParam)
{
PostMessage(hWnd, message, wParam, lParam); /* Can Only PostMessage() */
return; /* System State Is Unknown */
}

/**************** Receives Posted Message From CallbackProc() *********/

long FAR PASCAL WindowProc(HWND hWnd, unsigned message, WORD wParam, LONG lParam)
{
struct rmp
{
int BusyBit;
char Buffer[128];
} far *realModePtr = (struct rmp far *) lParam; /* PMode ptr to RMode String */
HDC hContext;

switch (message)
{
case WM_DESTROY:
PostQuitMessage( NULL );
PipeUnregisterCallback();
break;
case WM_USER:
hContext = GetDC( hWnd ); /* Need Display Context */
TextOut( hContext, 0, 0, realModePtr->Buffer, lstrlen(realModePtr->Buffer) );
realModePtr->BusyBit = FALSE;
ReleaseDC( hWnd, hContext ); /* Free Display Context */
UpdateWindow( hWnd );
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
}



  3 Responses to “Category : Files from Magazines
Archive   : WDMAY92.ZIP
Filename : 3N05032A

  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/