Click here to Skip to main content
15,902,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Pointer to function and templates Pin
prasad_som29-Sep-05 0:05
prasad_som29-Sep-05 0:05 
GeneralRe: Pointer to function and templates Pin
vmaltsev29-Sep-05 0:24
vmaltsev29-Sep-05 0:24 
GeneralRe: Pointer to function and templates Pin
prasad_som29-Sep-05 1:29
prasad_som29-Sep-05 1:29 
AnswerRe: Pointer to function and templates Pin
Steen Krogsgaard30-Sep-05 3:00
Steen Krogsgaard30-Sep-05 3:00 
QuestionMFC object CFormView Pin
karmendra_js28-Sep-05 23:11
karmendra_js28-Sep-05 23:11 
AnswerRe: MFC object CFormView Pin
prasad_som29-Sep-05 0:36
prasad_som29-Sep-05 0:36 
QuestionRe: MFC object CFormView Pin
karmendra_js29-Sep-05 0:54
karmendra_js29-Sep-05 0:54 
AnswerRe: MFC object CFormView Pin
Steen Krogsgaard30-Sep-05 3:07
Steen Krogsgaard30-Sep-05 3:07 
Allow me to elaborate:
CMainFrame * fram=(CMainFrame*)AfxGetMainWnd();
CMyDocument *doc=fram->GetActiveDocument();
POSITION pos = doc->GetFirstViewPosition();  
while (pos != NULL)   
{      
   CView* pView = doc->GetNextView(pos);  // not safe to cast to anything other than CView!
   if (pView->IsKindOf(RUNTIME_CLASS(CYourDerivedViewClass))) {
      CYourDerivedViewClass* pYour = (CYourDerivedViewClass*)pView; // this is just for convenience
      pYour->TheFunctionInQuestion();
   }

} 


But this makes your interface between the view classes dependent on implementation, and that's generally a bad idea. Instead I suggest you send private windows messages (or even registered ones) between you views. In CYourDerivedViewClass you can call the member function from the message handler, in this way the implementation stays in CYourDerivedViewClass. Much safer, much more clean.

Cheers
Steen.

"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"

-- modified at 9:07 Friday 30th September, 2005
QuestionVirtual function Pin
karmendra_js28-Sep-05 23:06
karmendra_js28-Sep-05 23:06 
AnswerRe: Virtual function Pin
Cedric Moonen28-Sep-05 23:43
Cedric Moonen28-Sep-05 23:43 
Questionvtbl question when derived Pin
followait28-Sep-05 22:44
followait28-Sep-05 22:44 
AnswerRe: vtbl question when derived Pin
Steen Krogsgaard30-Sep-05 3:37
Steen Krogsgaard30-Sep-05 3:37 
QuestionDeclare Byte Pin
Member 216100428-Sep-05 22:36
Member 216100428-Sep-05 22:36 
AnswerRe: Declare Byte Pin
kakan28-Sep-05 22:47
professionalkakan28-Sep-05 22:47 
GeneralRe: Declare Byte Pin
Member 216100428-Sep-05 23:20
Member 216100428-Sep-05 23:20 
GeneralRe: Declare Byte Pin
kakan28-Sep-05 23:29
professionalkakan28-Sep-05 23:29 
GeneralRe: Declare Byte Pin
toxcct28-Sep-05 23:38
toxcct28-Sep-05 23:38 
GeneralRe: Declare Byte Pin
kakan29-Sep-05 0:39
professionalkakan29-Sep-05 0:39 
GeneralRe: Declare Byte Pin
toxcct28-Sep-05 23:28
toxcct28-Sep-05 23:28 
AnswerRe: Declare Byte Pin
toxcct28-Sep-05 22:52
toxcct28-Sep-05 22:52 
AnswerRe: Declare Byte Pin
vikas amin28-Sep-05 23:05
vikas amin28-Sep-05 23:05 
QuestionCompiler Error C2504 please help Pin
WernerPos28-Sep-05 22:01
WernerPos28-Sep-05 22:01 
AnswerRe: Compiler Error C2504 please help Pin
Cedric Moonen28-Sep-05 22:07
Cedric Moonen28-Sep-05 22:07 
GeneralRe: Compiler Error C2504 please help Pin
WernerP28-Sep-05 22:38
WernerP28-Sep-05 22:38 
GeneralRe: Compiler Error C2504 please help Pin
WernerP28-Sep-05 22:46
WernerP28-Sep-05 22:46 

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.