Prev: Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application
Next: Warning: Cannot load CRuntimeMap from archive. Class not defined.
From: Joseph M. Newcomer on 18 Nov 2006 23:32 Actually, I do exactly what you describe: my display list has a Draw method and I invoke that. I didn't want to overwhelm him, but the solution of having a draw method of the display list is certainly the cleaner approach. joe On Sun, 19 Nov 2006 03:12:10 GMT, Dan Bloomquist <public21(a)lakeweb.com> wrote: > > >MarcoMB wrote: > >> Thanka a lot for your patience with me, i please you to understand i'm trying >> to learn on myself Visual C++ studying on book etc, and it's not my true job, >> i make it only for passion.So i tried to handle the static draw of my objects >> in WM_PAINT message as you said, and it's ok, the solution was under my eyes >> ... i'm going to studing Scribble carefully following your advice...and i'll >> consider all your help like gold...unfortunately i based my app on a sample >> tutorial i found on book that to mantain simple learning based the object on >> CObArray, but i've read what you say that it's going wrong with those type of >> generic object, and use instead template class that accept only specified >> type of data object like CArray.I'll try to modify my simple paint >> app...thanks a lot again. > >I have not looked at SRIBBLE in a while. > >Joe has gotten you see that OnDraw is where it happens. The only reason >for drawing in OnMouseMove is that the mouse is captured and the window >is on top. That makes it simple to eliminate flicker and use little >processor time. The strokes are going into the container where it counts. > >You may want to use typedefs. For instance in OnDraw you will see: > >CTypedPtrList<CObList,CStroke*>& strokeList... > >The more often you do this the more often You commit to the specific >container/method. In a header about drawing objects, (right after the >CStroke declaration in this case): > >typedef CTypedPtrList<CObList,CStroke*> STROKELIST; > >Here is why. In the example the doc is the container. What happens when >you want an independent generic container? You will soon have a class >that is just that and the doc is only about file io. At that the doc >could evolve to some 'project' io and know nothing about files. But you >will want to caompartmitize this stuff to make your work OO. So you will: > >typedef CDrawingImage STROKELIST; > >And CDrawingImageContainer does what the doc did at first. > >What about the view? Same thing can apply. The view can become more >generic and if the STROKELIST is snapped in, mouse moves can be relayed >when enabled and: > >void CScribbleView::OnDraw(CDC* pDC) >{ >//if attached/enabled > strokeList.Draw( pDC ); >//a one liner, and now it is windows portable. >} > >Take a good look at OnDraw. The view really has nothing to do with >drawing. It is done with the DC. What if you want your stuff to work >with the WTL? It can without a breath. > >I am not trying to overwhelm you. But this is what c++ is really about. >c++ is not an Object Oriented language, just an opportunity to program OO. > >Here is a simple implementation example of a class that works with MFC, >WTL, and a plain old winmain: > >https://secure.codeproject.com/opengl/EGA.asp >(the gagl class) > >Start with what Joe wrote. It is about how the API works, and it applies >to all platforms as well as windows implementations. > >Best, Dan. Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: MarcoMB on 19 Nov 2006 10:29 thanks a lot Joseph, can you finally say me about a good guide to Windows Drawing? "Joseph M. Newcomer" wrote: > Actually, I do exactly what you describe: my display list has a Draw method and I invoke > that. I didn't want to overwhelm him, but the solution of having a draw method of the > display list is certainly the cleaner approach. > joe > > On Sun, 19 Nov 2006 03:12:10 GMT, Dan Bloomquist <public21(a)lakeweb.com> wrote: > > > > > > >MarcoMB wrote: > > > >> Thanka a lot for your patience with me, i please you to understand i'm trying > >> to learn on myself Visual C++ studying on book etc, and it's not my true job, > >> i make it only for passion.So i tried to handle the static draw of my objects > >> in WM_PAINT message as you said, and it's ok, the solution was under my eyes > >> ... i'm going to studing Scribble carefully following your advice...and i'll > >> consider all your help like gold...unfortunately i based my app on a sample > >> tutorial i found on book that to mantain simple learning based the object on > >> CObArray, but i've read what you say that it's going wrong with those type of > >> generic object, and use instead template class that accept only specified > >> type of data object like CArray.I'll try to modify my simple paint > >> app...thanks a lot again. > > > >I have not looked at SRIBBLE in a while. > > > >Joe has gotten you see that OnDraw is where it happens. The only reason > >for drawing in OnMouseMove is that the mouse is captured and the window > >is on top. That makes it simple to eliminate flicker and use little > >processor time. The strokes are going into the container where it counts. > > > >You may want to use typedefs. For instance in OnDraw you will see: > > > >CTypedPtrList<CObList,CStroke*>& strokeList... > > > >The more often you do this the more often You commit to the specific > >container/method. In a header about drawing objects, (right after the > >CStroke declaration in this case): > > > >typedef CTypedPtrList<CObList,CStroke*> STROKELIST; > > > >Here is why. In the example the doc is the container. What happens when > >you want an independent generic container? You will soon have a class > >that is just that and the doc is only about file io. At that the doc > >could evolve to some 'project' io and know nothing about files. But you > >will want to caompartmitize this stuff to make your work OO. So you will: > > > >typedef CDrawingImage STROKELIST; > > > >And CDrawingImageContainer does what the doc did at first. > > > >What about the view? Same thing can apply. The view can become more > >generic and if the STROKELIST is snapped in, mouse moves can be relayed > >when enabled and: > > > >void CScribbleView::OnDraw(CDC* pDC) > >{ > >//if attached/enabled > > strokeList.Draw( pDC ); > >//a one liner, and now it is windows portable. > >} > > > >Take a good look at OnDraw. The view really has nothing to do with > >drawing. It is done with the DC. What if you want your stuff to work > >with the WTL? It can without a breath. > > > >I am not trying to overwhelm you. But this is what c++ is really about. > >c++ is not an Object Oriented language, just an opportunity to program OO. > > > >Here is a simple implementation example of a class that works with MFC, > >WTL, and a plain old winmain: > > > >https://secure.codeproject.com/opengl/EGA.asp > >(the gagl class) > > > >Start with what Joe wrote. It is about how the API works, and it applies > >to all platforms as well as windows implementations. > > > >Best, Dan. > Joseph M. Newcomer [MVP] > email: newcomer(a)flounder.com > Web: http://www.flounder.com > MVP Tips: http://www.flounder.com/mvp_tips.htm >
From: Ajay Kalra on 19 Nov 2006 18:03 MarcoMB wrote: > thanks a lot Joseph, can you finally say me about a good guide to Windows > Drawing? > Joe has a book on Win32 and it does have good discussion of GDI/drawing etc. Another text is by Petzold, which also has good discussion on this subject. --- Ajay
From: Joseph M. Newcomer on 19 Nov 2006 18:49 I haven't seen any. Our book "Win32 Programming" makes a pretty good stab at all the graphics APIs [shameless plug] but it still only scratches the surface. There had been a couple good Win16 graphics books, but they are all obsolete and in some ways harmful. But the fact I haven't seen any doesn't mean they don't exist. Maybe someone else has seen a good one. joe On Sun, 19 Nov 2006 07:29:01 -0800, MarcoMB <MarcoMB(a)discussions.microsoft.com> wrote: > > > thanks a lot Joseph, can you finally say me about a good guide to Windows >Drawing? > >"Joseph M. Newcomer" wrote: > >> Actually, I do exactly what you describe: my display list has a Draw method and I invoke >> that. I didn't want to overwhelm him, but the solution of having a draw method of the >> display list is certainly the cleaner approach. >> joe >> >> On Sun, 19 Nov 2006 03:12:10 GMT, Dan Bloomquist <public21(a)lakeweb.com> wrote: >> >> > >> > >> >MarcoMB wrote: >> > >> >> Thanka a lot for your patience with me, i please you to understand i'm trying >> >> to learn on myself Visual C++ studying on book etc, and it's not my true job, >> >> i make it only for passion.So i tried to handle the static draw of my objects >> >> in WM_PAINT message as you said, and it's ok, the solution was under my eyes >> >> ... i'm going to studing Scribble carefully following your advice...and i'll >> >> consider all your help like gold...unfortunately i based my app on a sample >> >> tutorial i found on book that to mantain simple learning based the object on >> >> CObArray, but i've read what you say that it's going wrong with those type of >> >> generic object, and use instead template class that accept only specified >> >> type of data object like CArray.I'll try to modify my simple paint >> >> app...thanks a lot again. >> > >> >I have not looked at SRIBBLE in a while. >> > >> >Joe has gotten you see that OnDraw is where it happens. The only reason >> >for drawing in OnMouseMove is that the mouse is captured and the window >> >is on top. That makes it simple to eliminate flicker and use little >> >processor time. The strokes are going into the container where it counts. >> > >> >You may want to use typedefs. For instance in OnDraw you will see: >> > >> >CTypedPtrList<CObList,CStroke*>& strokeList... >> > >> >The more often you do this the more often You commit to the specific >> >container/method. In a header about drawing objects, (right after the >> >CStroke declaration in this case): >> > >> >typedef CTypedPtrList<CObList,CStroke*> STROKELIST; >> > >> >Here is why. In the example the doc is the container. What happens when >> >you want an independent generic container? You will soon have a class >> >that is just that and the doc is only about file io. At that the doc >> >could evolve to some 'project' io and know nothing about files. But you >> >will want to caompartmitize this stuff to make your work OO. So you will: >> > >> >typedef CDrawingImage STROKELIST; >> > >> >And CDrawingImageContainer does what the doc did at first. >> > >> >What about the view? Same thing can apply. The view can become more >> >generic and if the STROKELIST is snapped in, mouse moves can be relayed >> >when enabled and: >> > >> >void CScribbleView::OnDraw(CDC* pDC) >> >{ >> >//if attached/enabled >> > strokeList.Draw( pDC ); >> >//a one liner, and now it is windows portable. >> >} >> > >> >Take a good look at OnDraw. The view really has nothing to do with >> >drawing. It is done with the DC. What if you want your stuff to work >> >with the WTL? It can without a breath. >> > >> >I am not trying to overwhelm you. But this is what c++ is really about. >> >c++ is not an Object Oriented language, just an opportunity to program OO. >> > >> >Here is a simple implementation example of a class that works with MFC, >> >WTL, and a plain old winmain: >> > >> >https://secure.codeproject.com/opengl/EGA.asp >> >(the gagl class) >> > >> >Start with what Joe wrote. It is about how the API works, and it applies >> >to all platforms as well as windows implementations. >> > >> >Best, Dan. >> Joseph M. Newcomer [MVP] >> email: newcomer(a)flounder.com >> Web: http://www.flounder.com >> MVP Tips: http://www.flounder.com/mvp_tips.htm >> Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: MarcoMB on 20 Nov 2006 17:20
yes Joe you're right it's difficult to find some good guide about win32 programming and graphics it's also a difficult and large argument... thanks for help "Joseph M. Newcomer" wrote: > I haven't seen any. Our book "Win32 Programming" makes a pretty good stab at all the > graphics APIs [shameless plug] but it still only scratches the surface. There had been a > couple good Win16 graphics books, but they are all obsolete and in some ways harmful. But > the fact I haven't seen any doesn't mean they don't exist. Maybe someone else has seen a > good one. > joe > > On Sun, 19 Nov 2006 07:29:01 -0800, MarcoMB <MarcoMB(a)discussions.microsoft.com> wrote: > > > > > > > thanks a lot Joseph, can you finally say me about a good guide to Windows > >Drawing? > > > >"Joseph M. Newcomer" wrote: > > > >> Actually, I do exactly what you describe: my display list has a Draw method and I invoke > >> that. I didn't want to overwhelm him, but the solution of having a draw method of the > >> display list is certainly the cleaner approach. > >> joe > >> > >> On Sun, 19 Nov 2006 03:12:10 GMT, Dan Bloomquist <public21(a)lakeweb.com> wrote: > >> > >> > > >> > > >> >MarcoMB wrote: > >> > > >> >> Thanka a lot for your patience with me, i please you to understand i'm trying > >> >> to learn on myself Visual C++ studying on book etc, and it's not my true job, > >> >> i make it only for passion.So i tried to handle the static draw of my objects > >> >> in WM_PAINT message as you said, and it's ok, the solution was under my eyes > >> >> ... i'm going to studing Scribble carefully following your advice...and i'll > >> >> consider all your help like gold...unfortunately i based my app on a sample > >> >> tutorial i found on book that to mantain simple learning based the object on > >> >> CObArray, but i've read what you say that it's going wrong with those type of > >> >> generic object, and use instead template class that accept only specified > >> >> type of data object like CArray.I'll try to modify my simple paint > >> >> app...thanks a lot again. > >> > > >> >I have not looked at SRIBBLE in a while. > >> > > >> >Joe has gotten you see that OnDraw is where it happens. The only reason > >> >for drawing in OnMouseMove is that the mouse is captured and the window > >> >is on top. That makes it simple to eliminate flicker and use little > >> >processor time. The strokes are going into the container where it counts. > >> > > >> >You may want to use typedefs. For instance in OnDraw you will see: > >> > > >> >CTypedPtrList<CObList,CStroke*>& strokeList... > >> > > >> >The more often you do this the more often You commit to the specific > >> >container/method. In a header about drawing objects, (right after the > >> >CStroke declaration in this case): > >> > > >> >typedef CTypedPtrList<CObList,CStroke*> STROKELIST; > >> > > >> >Here is why. In the example the doc is the container. What happens when > >> >you want an independent generic container? You will soon have a class > >> >that is just that and the doc is only about file io. At that the doc > >> >could evolve to some 'project' io and know nothing about files. But you > >> >will want to caompartmitize this stuff to make your work OO. So you will: > >> > > >> >typedef CDrawingImage STROKELIST; > >> > > >> >And CDrawingImageContainer does what the doc did at first. > >> > > >> >What about the view? Same thing can apply. The view can become more > >> >generic and if the STROKELIST is snapped in, mouse moves can be relayed > >> >when enabled and: > >> > > >> >void CScribbleView::OnDraw(CDC* pDC) > >> >{ > >> >//if attached/enabled > >> > strokeList.Draw( pDC ); > >> >//a one liner, and now it is windows portable. > >> >} > >> > > >> >Take a good look at OnDraw. The view really has nothing to do with > >> >drawing. It is done with the DC. What if you want your stuff to work > >> >with the WTL? It can without a breath. > >> > > >> >I am not trying to overwhelm you. But this is what c++ is really about. > >> >c++ is not an Object Oriented language, just an opportunity to program OO. > >> > > >> >Here is a simple implementation example of a class that works with MFC, > >> >WTL, and a plain old winmain: > >> > > >> >https://secure.codeproject.com/opengl/EGA.asp > >> >(the gagl class) > >> > > >> >Start with what Joe wrote. It is about how the API works, and it applies > >> >to all platforms as well as windows implementations. > >> > > >> >Best, Dan. > >> Joseph M. Newcomer [MVP] > >> email: newcomer(a)flounder.com > >> Web: http://www.flounder.com > >> MVP Tips: http://www.flounder.com/mvp_tips.htm > >> > Joseph M. Newcomer [MVP] > email: newcomer(a)flounder.com > Web: http://www.flounder.com > MVP Tips: http://www.flounder.com/mvp_tips.htm > |