home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4673 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.0 KB  |  56 lines

  1. Newsgroups: comp.windows.ms.programmer,comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!paladin.american.edu!gatech!mailer.cc.fsu.edu!loligo!rekle
  3. From: rekle@loligo.cc.fsu.edu (Rick Ekle (CompSci))
  4. Subject: Creating custom messages in Windows 3.1
  5. Message-ID: <1993Jan7.040719.11710@mailer.cc.fsu.edu>
  6. Summary: How do I create a new Windows message unique to my program, 
  7.          register it with Windows, and call it from within my program.
  8. Sender: news@mailer.cc.fsu.edu (Usenet News File Owner)
  9. Nntp-Posting-Host: loligo.cc.fsu.edu
  10. Organization: Florida State University Computing Center
  11. References: <1992Dec30.191610.3685@pony.Ingres.COM>
  12. Distribution: na world
  13. Date: Thu, 7 Jan 93 04:07:19 GMT
  14. Lines: 40
  15.  
  16. I was thinking the other day:
  17.  
  18. Is this possible?  I would like to create a custom message and call it
  19. from within my program.  i.e.
  20.  
  21. #define WM_MYNEWMESSAGE <integer value>
  22.  
  23. // ...later in the windows procedure:
  24. long FAR PASCAL _export WndProc(HWND hwnd, UINT message, UINT wParam, 
  25.                                 LONG lParam)
  26. {
  27.   int counter=10;
  28.   switch (message)
  29.   {
  30.     case WM_MYNEWMESSAGE:
  31.       // This case statement is basically the body of a simple for loop.
  32.       // The body of this statement is executed counter number of times.
  33.    
  34.       // Print a message to screen
  35.       --count;
  36.       if ( count != 0 )
  37.         SendMessage(hwnd,WM_MYNEWMESSAGE,0,0L);
  38.       return 0;
  39.     default:  // Pass message to DefWindowProc
  40.   }
  41. }
  42.  
  43. I figured that this technique would be usefull in performing long loops
  44. without tying up Windows in one program...  Other programs get to run and
  45. the loop still executes.
  46.  
  47. Is this even possible?
  48.  
  49. --
  50. /---------------------------------------------------------------------------\
  51. | Rick Ekle | rekle@loligo.cc.fsu.edu | Birth, School, Work, Death.         |
  52. |---------------------------------------------------------------------------|
  53. | "I survived Hurricane Andrew." | This Space For Rent | FSU #1!!!          |
  54. \---------------------------------------------------------------------------/
  55.  
  56.