Jump to content
  • Advertisement
Sign in to follow this  
giuseppeCT

Pleez help MFC C++

This topic is 5459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hola, please help me understand how to: 1: send a message from a class to another one, i'm using mfc and in my cview derived class i'd like to send a message to a dialog using SendMessage(etc etc...), the problem is that i need to make the class static, may someone clarify me how to call a non static member function (if i create an istance it works but nothing happen, coz it is not the one owning the dialog) 2:is good to use a CDocView derived class to collect all datas? thanx in advance !!!

Share this post


Link to post
Share on other sites
Advertisement
1)
why send a message from you're view class to a dialog?

best bet is to call a member function in the dialog class from the view class.

2) general rule for MFC apps, Document class stores data and the View class renders/displays the data.

Share this post


Link to post
Share on other sites
uhmm....how to call a member function passing data from view to the dialog? only by defining static vars and functions right? and however i need to update the dialog to make it display the changes, i guessed sending a paint message.......... thanx in advance !!!

Share this post


Link to post
Share on other sites
well you can make a function in the dialog box class that takes the data as parameters. i think you might also have to pass the this pointer for the view class as a pointer to a CView or whatever, so when the dialog box wants to refresh the view class it can just use that pointer to call Invalidate()

hope that helps, i'm no expert either :)

Share this post


Link to post
Share on other sites
eh, and the problem is, the function must be static right? may you write a lit example showing how that should works? i actually call a public and static member function of the dialog class from da view class........ thanx dude !!!

Share this post


Link to post
Share on other sites
i don't think you'd want to use a static function. a static function can be called without even having to create an instance of your dialog class. and when you call the static function, it will affect all instances of your dialog class.

unless that's the kind of behavior you want, i'd avoid the static function

Share this post


Link to post
Share on other sites
uhmm, to call a member funtion of another class i've to make it as static, i don't understand how to call a non static member funtion without creating an instance of that class, but if i create an instance of that class it is not the right one(talking about dialogs), so nothing happens in the real runtime dialog instance............i'm very very confused about !!! will continue to study..........thanx again!!

[Edited by - giuseppeCT on October 12, 2004 4:29:56 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!