home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15366 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  1.5 KB

  1. Path: sparky!uunet!wupost!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!YOSEMITE.CSUFRESNO.EDU!quang
  2. From: quang@YOSEMITE.CSUFRESNO.EDU (Quang Ngo)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Problem in C, please help!
  5. Message-ID: <9209112124.AA13676@yosemite.csufresno.edu>
  6. Date: 11 Sep 92 21:24:34 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Lines: 46
  9.  
  10.  
  11. I'm trying to write a simple keyboard driver that does the following:
  12.  
  13.   * It adds 1 to every character the user types, i.e., if the user types:
  14.     'Hello', what the user will see is: 'Ifmmp'.  In general, a -> b,
  15.     c -> d, s -> t, etc.
  16.     
  17.   * When the driver is running, no matter what application the user is
  18.     using the driver still works with that application.  This way, if
  19.     , for instance, the user is using MS Word, when he types 'Hello',
  20.     what he'll get is 'Ifmmp'.
  21.  
  22. Here's a segment of the code I'm trying:
  23.  
  24. HandleEvent()
  25. {
  26.     if (gWNEImplemented)
  27.         WaitNextEvent(everyEvent, &gTheEvent, SLEEP,
  28. NIL_MOUSE_REGION);
  29.     else {
  30.         SystemTask();
  31.         GetNextEvent(everyEvent, &gTheEvent);
  32.     }
  33.     
  34.     switch (gTheEvent.what) {
  35.         case nullEvent:
  36.             break;
  37.         case keyDown:
  38.             theChar = gTheEvent.message & charCodeMask;
  39.             theChar++;
  40.             /*printf("%c\n", theChar);*/
  41.             break;
  42.         case mouseDown:
  43.             gDone = TRUE;
  44.             break;
  45.     }
  46. }
  47.  
  48. Question:
  49.   How do I store the value in theChar++ back to the gTheEvent.message?
  50.   Did I miss something?
  51.  
  52. Thanks in advance.
  53.  
  54. Please email your help to
  55. -Quang (quang@yosemite.csufresno.edu)
  56.