///////////////////////////////////////////////////////////////////////////////
//
// Module: msgq.h
//
// Abstract: Inter-thread mailslot mechanism for Win95
//
// Author: Mark Hornick
//
// Revisions:
// $History: MSGQ.H $
//
// ***************** Version 2 *****************
<- Note modification history inserted by version control
// User: Markh Date: 1/10/97 Time: 3:17p
// Updated in $/QuickTeach/msgqueue
// add msg queue length limit for MOC
//
// ***************** Version 1 *****************
<-
// User: Markh Date: 10/17/95 Time: 1:57p
// Created in $/QuickTeach/msgqueue
//
// Copyright 1995 ABB Flexible Automation, Inc.
//
///////////////////////////////////////////////////////////////////////////////
#define MAXQUEUENUMBER 32
typedef struct
MessageQueue {
// implementation of linked list of msgs
struct
MessageQueue* pNextMsg;
// ptr to next
message
void*
pMsg;
// ptr to msg data
long
nMsgLength;
// length of msg in bytes
} MESSAGEQUEUE, *LPMESSAGEQUEUE;
typedef struct QueueHeader {
// header for linked list of msgs
struct
QueueHeader* pNextHeader; // ptr to next QUEUEHEADER
struct in linked list
LPMESSAGEQUEUE pMsgQueue;
// ptr to first msg in this queue
char*
pszQueueName;
// ptr to queue name string
HANDLE hReadEvent;
// HANDLE to Read Event object used for read timeouts
DWORD dwReadTimeoutValue;
// read timeout value of Read Event object
long
nMaxMsgs;
// maximum number of msgs for this queue
long
nCurrentMsgs;
// current number of msgs in this queue
HANDLE hWriteEvent;
// HANDLE to Write Event object used for write timeouts
DWORD dwWriteTimeoutValue;
// write timeout value of Write Event object
} QUEUEHEADER, *LPQUEUEHEADER;
HANDLE CreateMsgQueue( char* szQueueName, DWORD
dwReadTimeout );
HANDLE OpenMsgQueue( char* szQueueName );
BOOL SetMsgQueueInfo( HANDLE hQueue, DWORD dwReadTimeout );
BOOL SetMsgQueueWriteTimeout( HANDLE hQueue, DWORD dwWriteTimeout );
BOOL SetMsgQueueMaxMsgs( HANDLE hQueue, long
nMaxMsgs );
BOOL ReadMsgQueue( HANDLE hQueue, LPVOID lpBuffer, DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead );
BOOL WriteMsgQueue( HANDLE hQueue, LPVOID lpBuffer, DWORD dwNumberOfBytesToWrite,
LPDWORD lpdwNumberOfBytesWritten );
...