----- Original Message -----
From: "Josu Onandia" <jon...@ao...>
To: "'Vlada Djurovic'" <dj...@im...>; "'DevC++ help'"
<dev...@li...>
Sent: Thursday, February 20, 2003 12:25 PM
Subject: RE: [Dev-C++] why doesn't this work?
> It's not a good idea to draw on a window when it's created. Do it when it
> receives the message WM_PAINT. Or even better have a look to this
wonderful
> book:
>
> http://www.charlespetzold.com/oop/pw4.html
>
>
Thanks for the tip, didn't know that (and for the URL). I changed the code
to
HDC hDC;
PAINTSTRUCT ps;
case WM_PAINT:
{
char str[]="Display text";
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,100,100,str,lstrlen(str));
EndPaint(hwnd,&ps);
}
and it works. Also, thanks to Carlos.
> > -----Mensaje original-----
> > De: Vlada Djurovic [SMTP:dj...@im...]
> > Enviado el: jueves 20 de febrero de 2003 10:15
> > Para: 'DevC++ help'
> > Asunto: [Dev-C++] why doesn't this work?
> >
> > Hi.
> > This is suppposed to be simple, but I can't get it to work. All I want
to
> > do
> > is display some text using TextOut function, but I get only a blank
> > window.
> > Here's the code:
> >
> > HDC hDC;
> > case WM_CREATE:
> > {
> > char str[]="Display text";
> > hDC=GetDC(hwnd);
> > TextOut(hDC,100,100,str,lstrlen(str));
> > ReleaseDC(hwnd,hDC);
> > }
> > break;
> >
> > What am I doing wrong?
> > ------------
> > Vlada
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
> > The most comprehensive and flexible code editor you can use.
> > Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
> > www.slickedit.com/sourceforge
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|