Article View: comp.os.ms-windows.programmer.misc
Article #2204OWL - is it possible...?
From: J.C. Ashworth
Date: Mon, 23 Nov 1992 18:23
Date: Mon, 23 Nov 1992 18:23
46 lines
1936 bytes
1936 bytes
I have been trying to use the following code to construct an OWL Window that contains some text when it is
first displayed.
(Similar code could be used for lots of other GDI functions - lines, circles, etc).
class TTestWindow : public TWindow
{
public:
TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
}
TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle)
: TWindow(AParent, ATitle)
{
HDC TheDC = GetDC(HWindow);
TextOut(TheDC, 20, 20, "Please work", 11);
ReleaseDC(TheDC, HWindow);
}
void TTestApp::InitMainWindow()
{
MainWindow = new TTestWindow(NULL, "Test Window");
}
...
As you can see, the code that draws the text is included in the window constructor. And this is where the
difficulty lies. When attempting to get a DC, it appears that the HWindow data member passed to GetDC()
does not have the value of the TTestWindow being constructed. Indeed, the text actually gets drawn in the
window from which the program is executed!
I have tried experimenting a little with SetupWindow() member functions, but to no avail. It seems such a
straightforward thing to want to do, that it must be possible. Surely?? Please?!?
If anyone has any advice on how to get round this problem, I'd be very grateful.
----------------------------------------------------------------
Jules Ashworth
"There is an art to being pathetic..."
jca17@phx.cam.ac.uk
----------------------------------------------------------------
Technical Details
Message-ID:
<1992Nov23.182322.22893@infodev.cam.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!pavo.csi.cam.ac.uk!jca17Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!pavo.csi.cam.ac.uk!jca17 From: jca17@phx.cam.ac.uk (J.C. Ashworth) Newsgroups: comp.os.ms-windows.programmer.misc Subject: OWL - is it possible...? Keywords: Borland, OWL Message-ID: <1992Nov23.182322.22893@infodev.cam.ac.uk> Date: 23 Nov 92 18:23:22 GMT Sender: jca17@cl.cam.ac.uk (J.C. Ashworth) Organization: U of Cambridge Computer Lab, UK Lines: 46 Nntp-Posting-Host: hall.cl.cam.ac.uk