#include #include #include //fro _kbhit #include //for CreateFileMapping and MapViewOfFile struct IPC { unsigned int serial; int x; int y; int count; int peak; }; static const char MemoryName[]="UFOCaptureV2_IPC_DATA_00000200601"; static HANDLE hMemory; struct IPC * IPC; int _tmain(int argc, _TCHAR* argv[]) { hMemory=CreateFileMapping(INVALID_HANDLE_VALUE ,NULL,PAGE_READWRITE,0,sizeof(IPC),MemoryName); if(!hMemory) { printf("Cannot create file mapping"); return -1; } IPC=(struct IPC *)MapViewOfFile(hMemory,FILE_MAP_READ,0,0,sizeof(IPC)); if(!IPC) { printf("Cannot map view of file"); CloseHandle(hMemory); return -1; } printf("UFO2IPC-Started. Type someting to exit\n"); unsigned int last_serial = 0; while(!_kbhit()) { if(IPC->serial > 0 && IPC->serial != last_serial) { last_serial = IPC->serial; printf("serial= %d, x=%d, y=%d, count=%d, peak=%d\n", IPC->serial,IPC->x, IPC->y, IPC->count, IPC->peak); } Sleep(20); } UnmapViewOfFile(IPC); CloseHandle(hMemory); return 0; }