#include #include "mque2.h" #define MAX_SLOTS 8 #define MAX_LENGTH 120 static char szValue[MAX_SLOTS + 1][MAX_LENGTH] ; static int nNextIn = 1;//input static int nNextOut = 1;//output static int nCount = 0; static int debug = 0; static int mode = 0; static char szTest[20] = "MQUE.DLL"; static int nVersion = 1; HWND hWnd; HGLOBAL hglb; HGLOBAL hglb2; void FAR* lpvBuffer; HGLOBAL pArray[10]; extern "C" DllExport1 int DllExport2 DllCall PutString(char FAR *p1) { int rc = 0; if (nCount < MAX_SLOTS) { if (strlen(p1) < MAX_LENGTH) { _fstrcpy(szValue[nNextIn], p1); if (mode) _fstrupr(szValue[nNextIn]); rc = 1; if (++nNextIn > MAX_SLOTS) nNextIn = 1; ++nCount; szValue[0][0] = 0; } else { _fstrcpy(szValue[0], "ERR TOO LONG"); } } else { _fstrcpy(szValue[0], "Queue is full"); } if (rc == 0 && debug) { MessageBox(NULL, szValue[0], "MQUE.DLL PutString ERR! ", MB_OK); } return (rc); } extern "C" DllExport1 int DllExport2 DllCall GetString(char FAR *p1) { char FAR *p; int rc = -1; if (nCount > 0) { p = szValue[nNextOut]; _fstrcpy(p1, p); rc = strlen(p); if (++nNextOut > MAX_SLOTS) nNextOut = 1; --nCount; szValue[0][0] = 0; } else { *p1 = 0; } if (debug && rc == 0 ) { MessageBox(NULL, "No messages", "MQUE.DLL GetString ERR!", MB_OK); } return (rc); } extern "C" DllExport1 int DllExport2 DllCall GetError(char FAR *p1) { char FAR *p; int rc; p = szValue[0]; _fstrcpy(p1, p); rc = strlen(p); szValue[0][0] = 0; return (rc); } extern "C" DllExport1 int DllExport2 DllCall SetDebug(int nValue) { debug = nValue; return (debug); } extern "C" DllExport1 int DllExport2 DllCall SetMode(int nValue) { mode = nValue; return (mode); } extern "C" DllExport1 int DllExport2 DllCall Reset() { nNextOut = 1; nNextIn = 1; nCount = 0; szValue[0][0] = 0; return (1); } extern "C" DllExport1 int DllExport2 DllCall GetMaxLength(int *nSlots) { *nSlots = MAX_SLOTS; return (MAX_LENGTH); } extern "C" DllExport1 int DllExport2 DllCall Test(char FAR * pString) { char FAR *p; int nVersion; #ifdef DLLTYPE_3x nVersion = 1; #endif #ifdef DLLTYPE_NT nVersion = 2; #endif #ifdef DLLTYPE_95 nVersion = 3; #endif p = szTest; _fstrcpy(pString, p); return nVersion; }