Category : C Source Code
Archive   : WMSERI.ZIP
Filename : WNOTIFY.C

 
Output of file : WNOTIFY.C contained in archive : WMSERI.ZIP
//
// W M S E R I A L - Windows Modem Example
//
// This is only part of a multiple source project. To build the
// executable please use the makefile provided or construct
// a project file containing the files and settings listed in
// PROJECT.TXT.
//
// Remember to modify the directories to reflect your configuration.
//
// - J A A

// WNOTIFY.C

#include
#include "wmserial.h"


int ProcessCommNotify(HWND hWnd, int nComID, int nNotification)
{
HANDLE hBufferMem;
LPSTR szData;
int nResult;

// Process Receive Notice
if ( nNotification & CN_RECEIVE )
{
// Get memory for data
hBufferMem = GlobalAlloc( GMEM_MOVEABLE, QBUFFSIZE );
if (!hBufferMem)
{
MessageBeep(MB_ICONEXCLAMATION);
MessageBox(hWnd,"Not enough memory for initializing modem.","Example Windows Terminal",MB_ICONSTOP);
PostMessage(hWnd,WM_CLOSE,0,0L);
return NULL;
}
szData = (LPSTR) GlobalLock(hBufferMem);

nResult = ReadComPort ( nComID, szData, QBUFFSIZE-1 );
if (nResult > 0)
{
szData[nResult] = 0;
TTYWriteScreen(szData);
}
else if (nResult < 0)
{
szData[-nResult] = 0;
TTYWriteScreen(szData);
GlobalUnlock(hBufferMem);
return nResult;
}
GlobalUnlock(hBufferMem);
CheckComPort(nComID,NULL);
}


// Process Transmit Notice
if ( nNotification & CN_TRANSMIT )
nResult = WriteComPort(nComID, NULL, NULL);
// Last Error is left for CheckComPort() call


return nResult;
}



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