home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3622 < prev    next >
Encoding:
Text File  |  1992-11-23  |  1.8 KB  |  59 lines

  1. Path: sparky!uunet!mcsun!uknet!pavo.csi.cam.ac.uk!jca17
  2. From: jca17@phx.cam.ac.uk (J.C. Ashworth)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: OWL - is it possible...?
  5. Keywords: Borland, OWL
  6. Message-ID: <1992Nov23.182322.22893@infodev.cam.ac.uk>
  7. Date: 23 Nov 92 18:23:22 GMT
  8. Sender: jca17@cl.cam.ac.uk (J.C. Ashworth)
  9. Organization: U of Cambridge Computer Lab, UK
  10. Lines: 46
  11. Nntp-Posting-Host: hall.cl.cam.ac.uk
  12.  
  13. I have been trying to use the following code to construct an OWL Window that contains some text when it is
  14. first displayed.
  15. (Similar code could be used for lots of other GDI functions - lines, circles, etc).
  16.  
  17.  
  18.  
  19. class TTestWindow : public TWindow
  20. {
  21. public:
  22.   TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
  23. }
  24.  
  25. TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle)
  26.   : TWindow(AParent, ATitle)
  27. {
  28.   HDC TheDC = GetDC(HWindow);
  29.   TextOut(TheDC, 20, 20, "Please work", 11);
  30.   ReleaseDC(TheDC, HWindow);
  31. }
  32.  
  33. void TTestApp::InitMainWindow()
  34. {
  35.   MainWindow = new TTestWindow(NULL, "Test Window");
  36. }
  37.  
  38. ...
  39.  
  40.  
  41.  
  42. As you can see, the code that draws the text is included in the window constructor.  And this is where the
  43. difficulty lies.  When attempting to get a DC, it appears that the HWindow data member passed to GetDC()
  44. does not have the value of the TTestWindow being constructed.  Indeed, the text actually gets drawn in the
  45. window from which the program is executed!
  46.  
  47. I have tried experimenting a little with SetupWindow() member functions, but to no avail.  It seems such a
  48. straightforward thing to want to do, that it must be possible.  Surely??  Please?!?
  49.  
  50. If anyone has any advice on how to get round this problem, I'd be very grateful.
  51.  
  52.  
  53. ----------------------------------------------------------------
  54. Jules Ashworth
  55. "There is an art to being pathetic..."
  56.  
  57. jca17@phx.cam.ac.uk
  58. ----------------------------------------------------------------
  59.