home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / os2 / programm / 6386 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  1.6 KB

  1. Path: sparky!uunet!ogicse!emory!gwinnett!oneup.gwinnett.com!fred
  2. From: fred@oneup.gwinnett.com (Fred Christianson)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: WinCreateWindow(...pCtlData,..) -> WM_CREATE problem
  5. Summary: mp1 is not always pCtlData
  6. Message-ID: <721566380fred.fred@oneup.gwinnett.com>
  7. Date: 12 Nov 92 11:06:20 GMT
  8. Article-I.D.: oneup.721566380fred.fred
  9. References: <721564770fred.fred@oneup.gwinnett.com>
  10. Sender: fred@oneup.gwinnett.com
  11. Organization: One Up Corporation
  12. Lines: 30
  13.  
  14.  
  15.  
  16. --
  17.  
  18. I've had this happen in 3 programs I've writen, and now a coworker
  19. just found it happening in his program.
  20.  
  21. I do a WinCreateWindow() and have the pCtlData parameter pointing
  22. to an initialization structure.  When the window procedure gets
  23. a WM_CREATE message, mp1 is supposed to have the pCtlData pointer, and
  24. most of the time it does.  
  25.  
  26. But, about 1 in 5-10 times mp1 is not the same as the pointer I had in
  27. WinCreateWindow().  Sometimes it has been 16 bytes off of the correct
  28. pointer, but other times it looks nothing like the origional.  
  29.  
  30. I've tried having pCtlData point to a local, a global, and a malloc()'ed
  31. structure, and they all do the same things.  
  32.  
  33. After this happens, WinGetLastError() returns 0x6000.
  34.  
  35. I've been getting around the problem by setting a global to what pCtlData
  36. should point to, then using the global instead of mp1 in the message.
  37. When I do that, everything works fine.  It also lets me compare the global
  38. to mp1 in the WM_CREATE message, and put up a message box when they 
  39. are different, which comes out to be 1 in 5-10 times.
  40.  
  41.  
  42.  
  43. Fred Christianson (fred@oneup.gwinnett.com)
  44.