#include <windows.h>
#include <pcrt32.h>
long WM_MCOMMAND = WM_USER + 200;
typedef struct {
DWORD mVersion;
HWND mHwnd;
BOOL mKeep;
} LOADINFO;
class mIRC {
public:
int mSendMessage(char *);
HWND hWnd;
};
int mIRC::mSendMessage(char *sText)
{
if (!hWnd) return 0;
void *hFile;
void *pData;
hFile = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,1024,"mIRC");
if (!hFile)
MessageBox(hWnd,(char *)"Can't create a file mapping object.",(char *)"Error...",MB_OK);
pData = MapViewOfFile(hFile,FILE_MAP_ALL_ACCESS,0,0,0);
if (!pData)
MessageBox(hWnd,(char *)"Can't map view of the file.",(char *)"Error...",MB_OK);
if (pData) {
_fstrcpy((char *)pData,sText);
SendMessage(hWnd,WM_MCOMMAND,1,0);
UnmapViewOfFile(pData);
CloseHandle(hFile);
return 0;
}
return 1;
}