Click here to Skip to main content
15,913,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SetWindowText problem - please look at that Pin
jmkhael28-Jul-04 6:56
jmkhael28-Jul-04 6:56 
GeneralRe: SetWindowText problem - please look at that Pin
Igor Mihailov28-Jul-04 7:54
Igor Mihailov28-Jul-04 7:54 
GeneralRe: SetWindowText problem - please look at that Pin
David Crow28-Jul-04 8:17
David Crow28-Jul-04 8:17 
GeneralRe: SetWindowText problem - please look at that Pin
Jaime Stuardo28-Jul-04 8:42
Jaime Stuardo28-Jul-04 8:42 
GeneralRe: SetWindowText problem - please look at that Pin
bikram singh28-Jul-04 9:17
bikram singh28-Jul-04 9:17 
GeneralRe: SetWindowText problem - please look at that Pin
David Crow28-Jul-04 9:30
David Crow28-Jul-04 9:30 
Generalwhups Pin
bikram singh28-Jul-04 9:46
bikram singh28-Jul-04 9:46 
GeneralWindow OnPaint overrding Pin
act_x28-Jul-04 6:34
act_x28-Jul-04 6:34 
I have an MFC based app that uses the SDI methodology .


I have a View that creates and maintains a CWnd derived class pointer (CScreen *ptr) .


Now this app is an interactive GUI and I have to display various Screens for which I have implemented classes that derive from CScreen .CScreenDerived1 , CScreenDerived2


Now based on the stage of the GUI the view creates objects of different types = CScreenDerived1 , CScreenDerived2 using the *ptr to point to derived class objects !

like this in the view.cpp file
<br />
 case 1:<br />
	   ptr = (CScreen *) new CScreenDerived1(this);<br />
	   break;<br />
 case 2:<br />
          ptr=(CScreen *) new CScreenDerived2(this);<br />
           break;
Now i have handled the WM_PAINT message in CScreen by implementing OnPaint

Screen.h file ---------------------------
//{{AFX_MSG(CScreen)<br />
	afx_msg void OnPaint();

Screen.cpp -------------------------------
<br />
BEGIN_MESSAGE_MAP(CScreen, CWnd)<br />
   ON_MESSAGE(ID_SCREEN_REPAINT, ScreenRefresh)     // handler for posted message refresh<br />
   //{{AFX_MSG_MAP(CScreen)<br />
	ON_WM_PAINT()<br />
	ON_WM_LBUTTONDOWN()<br />
	ON_WM_ERASEBKGND()<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()


Also I want to do specific rendering tasks for which I thought of overriding the OnPaint in the derived classes so Using classView I added an OnPaint Function in CScreenDerved1 and CScreenServied 2 , but I found that the breakpoints that i set in the entry points of these functions was never called .


I found a way that worked where I added the afx call (.h) and the MESSAGE MAP entry(.cpp) in the derived classes and the call was made .

I was assuming that polymorphism will help me out when I directly overrode the OnPaint method in the derived class .

I would be grateful if someone can expalin the mechanism used in this case .
is it because ive done this
ptr=(CScreen *) and forced the type cast !
GeneralRe: Window OnPaint overrding Pin
Johan Rosengren28-Jul-04 9:05
Johan Rosengren28-Jul-04 9:05 
GeneralWin Xp vs 2K error Pin
doctorpi28-Jul-04 5:43
doctorpi28-Jul-04 5:43 
GeneralRe: Win Xp vs 2K error Pin
bikram singh28-Jul-04 9:20
bikram singh28-Jul-04 9:20 
GeneralRe: Win Xp vs 2K error Pin
doctorpi28-Jul-04 9:45
doctorpi28-Jul-04 9:45 
GeneralRe: Win Xp vs 2K error Pin
User 58385228-Jul-04 14:49
User 58385228-Jul-04 14:49 
GeneralRe: Win Xp vs 2K error Pin
doctorpi28-Jul-04 22:04
doctorpi28-Jul-04 22:04 
GeneralSTL container over DLL Export Pin
peterchen28-Jul-04 3:41
peterchen28-Jul-04 3:41 
GeneralRe: STL container over DLL Export Pin
vmaltsev28-Jul-04 11:56
vmaltsev28-Jul-04 11:56 
GeneralData Library Pin
sweep12328-Jul-04 3:30
sweep12328-Jul-04 3:30 
GeneralReplacing a substring using a string class Pin
Igor Mihailov28-Jul-04 2:29
Igor Mihailov28-Jul-04 2:29 
GeneralRe: Replacing a substring using a string class Pin
Dimitris Vasiliadis28-Jul-04 2:59
Dimitris Vasiliadis28-Jul-04 2:59 
GeneralBarcode application Pin
Anonymous28-Jul-04 1:40
Anonymous28-Jul-04 1:40 
GeneralCPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 1:28
A_Fa28-Jul-04 1:28 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
basementman28-Jul-04 4:10
basementman28-Jul-04 4:10 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 20:43
A_Fa28-Jul-04 20:43 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
David Crow28-Jul-04 6:07
David Crow28-Jul-04 6:07 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 22:19
A_Fa28-Jul-04 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.