Click here to Skip to main content
15,919,479 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: FindResource Pin
Sparticus5-Aug-02 12:13
Sparticus5-Aug-02 12:13 
GeneralUsing regedit and the command line... Pin
esapp4205-Aug-02 11:13
esapp4205-Aug-02 11:13 
Questionhow to access an object that is declared in view1, when in view2? Pin
ns5-Aug-02 10:52
ns5-Aug-02 10:52 
AnswerRe: how to access an object that is declared in view1, when in view2? Pin
Tomasz Sowinski5-Aug-02 11:02
Tomasz Sowinski5-Aug-02 11:02 
GeneralRe: how to access an object that is declared in view1, when in view2? Pin
nss5-Aug-02 12:47
nss5-Aug-02 12:47 
GeneralRe: how to access an object that is declared in view1, when in view2? Pin
Chris Losinger5-Aug-02 13:39
professionalChris Losinger5-Aug-02 13:39 
GeneralRe: how to access an object that is declared in view1, when in view2? Pin
nss5-Aug-02 13:53
nss5-Aug-02 13:53 
AnswerRe: how to access an object that is declared in view1, when in view2? Pin
Steen Krogsgaard7-Aug-02 0:29
Steen Krogsgaard7-Aug-02 0:29 
While I agree that the db member should be in the doc and not in the view, there's nothing programatically wrong with what you've been doing. IntelliSense cannot show you the members of CTrain1View since your pView is of type CView*, but casting it to CTrain1View* should work:

POSITION pos = pDoc->GetFirstViewPosition();
while (pos!= NULL)
{
   CTrain1View* pView = (CTrain1View*)(pDoc->GetNextView(pos));
   ASSERT_VALID(pView);
   pView->db.MyFunc(arg from view2); // here IntelliSense should show you db as a member of the object pointed to by pView
}


But of course, hard-coding a type cast like this is error prone. You could make it a little nicer by checking the type before the cast:
CView* pView = pDoc->GetNextView(pos);
ASSERT_VALID(pView);
if (pView->IsKindOf(CRUNTIME_CLASS(CTrain1View)))
   ((CTrain1View*)pView)->db.MyFunc(arg from view2);


Still, putting it in the doc is the right thing to do.



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"
Generalmessage handling Pin
help5-Aug-02 10:50
help5-Aug-02 10:50 
Generalstandard save dialog problem Pin
Brad Jennings5-Aug-02 10:44
Brad Jennings5-Aug-02 10:44 
GeneralRe: standard save dialog problem Pin
Ernest Laurentin5-Aug-02 10:50
Ernest Laurentin5-Aug-02 10:50 
GeneralRe: standard save dialog problem Pin
Brad Jennings5-Aug-02 11:06
Brad Jennings5-Aug-02 11:06 
GeneralRe: standard save dialog problem Pin
Brad Jennings5-Aug-02 11:36
Brad Jennings5-Aug-02 11:36 
GeneralRe: standard save dialog problem Pin
Ernest Laurentin5-Aug-02 11:51
Ernest Laurentin5-Aug-02 11:51 
GeneralDestroyWindow Issues Pin
tjkrz5-Aug-02 10:37
tjkrz5-Aug-02 10:37 
GeneralRe: DestroyWindow Issues Pin
Tomasz Sowinski5-Aug-02 10:47
Tomasz Sowinski5-Aug-02 10:47 
GeneralRe: DestroyWindow Issues Pin
tjkrz5-Aug-02 10:52
tjkrz5-Aug-02 10:52 
GeneralRe: DestroyWindow Issues Pin
Tomasz Sowinski5-Aug-02 11:03
Tomasz Sowinski5-Aug-02 11:03 
GeneralRe: DestroyWindow Issues Pin
tjkrz6-Aug-02 2:51
tjkrz6-Aug-02 2:51 
GeneralSimple ADO question ... Pin
Hadi Rezaee5-Aug-02 9:43
Hadi Rezaee5-Aug-02 9:43 
GeneralRe: Simple ADO question ... Pin
Christian Graus5-Aug-02 13:18
protectorChristian Graus5-Aug-02 13:18 
GeneralRe: Simple ADO question ... Pin
Hadi Rezaee6-Aug-02 7:09
Hadi Rezaee6-Aug-02 7:09 
GeneralRe: Simple ADO question ... Pin
Christian Graus6-Aug-02 13:19
protectorChristian Graus6-Aug-02 13:19 
GeneralRe: Simple ADO question ... Pin
Hadi Rezaee7-Aug-02 5:18
Hadi Rezaee7-Aug-02 5:18 
QuestionHow to implement a external event in a app ? Pin
Cris5-Aug-02 9:31
Cris5-Aug-02 9:31 

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.