[192.168.0.16] #include #include #include #include void Dump2(Word data) { char buffer[6]; Int2Hex(data, buffer + 1, 4); buffer[0] = '$'; buffer[5] = 0; WriteCString(buffer); } void Dump4(LongWord data) { char buffer[10]; Long2Hex(data, buffer + 1, 8); buffer[0] = '$'; buffer[9] = 0; WriteCString(buffer); } int main(void) { Word MyID; Handle dp; static EventRecord event; TextStartUp(); SetOutputDevice(1,3); SetOutGlobals(0x7f, 0); MyID = MMStartUp(); dp = NewHandle(0x0100, MyID, attrBank | attrPage |attrNoCross | attrFixed | attrLocked, 0x000000); if (_toolErr) { ErrWriteCString("Unable to allocate dp memory\r\n"); DisposeHandle(dp); TextShutDown(); return 1; } HLock(dp); EMStartUp((Word)*dp, 0x14, 0, 0, 0, 0, MyID); while (!GetNextEvent(keyDownMask | autoKeyMask ,&event)); // dump the event record. WriteCString("Event.what: "); Dump2(event.what); WriteLine(""); WriteCString("Event.message: "); Dump4(event.message); WriteLine(""); WriteCString("Event.modifiers: "); Dump2(event.modifiers); WriteLine(""); EMShutDown(); TextShutDown(); return 0; }