Click here to Skip to main content
15,915,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Send Integer to DLL Pin
bob1697227-Jun-06 19:17
bob1697227-Jun-06 19:17 
GeneralRe: Send Integer to DLL Pin
borono27-Jun-06 19:35
borono27-Jun-06 19:35 
GeneralRe: Send Integer to DLL Pin
Anna-Jayne Metcalfe27-Jun-06 21:48
Anna-Jayne Metcalfe27-Jun-06 21:48 
GeneralRe: Send Integer to DLL Pin
borono27-Jun-06 22:08
borono27-Jun-06 22:08 
AnswerRe: Send Integer to DLL Pin
S Douglas28-Jun-06 12:21
professionalS Douglas28-Jun-06 12:21 
QuestionAccesing protected function from another class Pin
Ram Murali27-Jun-06 16:00
Ram Murali27-Jun-06 16:00 
AnswerRe: Accesing protected function from another class Pin
Michael Dunn27-Jun-06 16:11
sitebuilderMichael Dunn27-Jun-06 16:11 
GeneralRe: Accesing protected function from another class [modified] Pin
The Other Brad Larsen27-Jun-06 17:36
The Other Brad Larsen27-Jun-06 17:36 
I recently ran into a problem related to the topic, was wondering if anyone has any ideas...

The setup:

<br />
class CView<br />
{<br />
  friend class CPreviewView;<br />
  <br />
protected:<br />
  BOOL DoSomething();<br />
};<br />
<br />
class CPreviewView : public CView<br />
{<br />
public:<br />
  void SetSomething(CView* pView)<br />
  {<br />
    // Various lines of code here<br />
    ...<br />
<br />
    pView->DoSomething();<br />
<br />
    // Various lines of code here<br />
    ...<br />
  }<br />
};<br />
<br />
class CMyPreviewView : public CPreviewView<br />
{<br />
public:<br />
  // Add/change functionality or fix a bug<br />
  void SetSomething(CView* pView)<br />
  {<br />
    // NOTE: Can't call CPreviewView::SetSomething here, as<br />
    // there are lines of code in it I don't want executed<br />
<br />
    ...<br />
<br />
    // Must call DoSomething in order for this function to work<br />
    pView->DoSomething();<br />
<br />
    ...<br />
  }<br />
};<br />


CPreviewView is granted access to DoSomething since it's declared as a friend in the CView class. In the CMyPreviewView class, access is denied to DoSomething since CMyPreviewView isn't declared as a friend.

a) If these were my own classes, I could simply add a new friend class statement to CView. Both CView and CPreviewView are MFC classes, and I don't want to touch the MFC code.

b) If the DoSomething function were virtual, I could simply add an override to CMyPreviewView.
* scratch that *

Is there a simple way that I can somehow grant CMyPreviewView public access to CView::DoSomething?


-- modified at 23:44 Tuesday 27th June, 2006
QuestionAppend a space to a string... Pin
Shrinaresh27-Jun-06 13:09
Shrinaresh27-Jun-06 13:09 
AnswerRe: Append a space to a string... Pin
Maximilien27-Jun-06 13:27
Maximilien27-Jun-06 13:27 
GeneralRe: Append a space to a string... Pin
Shrinaresh27-Jun-06 13:36
Shrinaresh27-Jun-06 13:36 
AnswerRe: Append a space to a string... Pin
Michael Dunn27-Jun-06 13:41
sitebuilderMichael Dunn27-Jun-06 13:41 
GeneralRe: Append a space to a string... Pin
Shrinaresh27-Jun-06 15:58
Shrinaresh27-Jun-06 15:58 
AnswerRe: Append a space to a string... Pin
Christian Graus27-Jun-06 13:42
protectorChristian Graus27-Jun-06 13:42 
AnswerThis is what I am trying to do... Pin
Shrinaresh27-Jun-06 16:08
Shrinaresh27-Jun-06 16:08 
GeneralRe: This is what I am trying to do... Pin
Michael Dunn27-Jun-06 16:16
sitebuilderMichael Dunn27-Jun-06 16:16 
GeneralRe: This is what I am trying to do... Pin
Shrinaresh27-Jun-06 16:36
Shrinaresh27-Jun-06 16:36 
QuestionRe: This is what I am trying to do... Pin
David Crow28-Jun-06 7:33
David Crow28-Jun-06 7:33 
QuestionRe: Append a space to a string... Pin
David Crow28-Jun-06 6:15
David Crow28-Jun-06 6:15 
AnswerRe: Append a space to a string... Pin
Shrinaresh28-Jun-06 7:18
Shrinaresh28-Jun-06 7:18 
GeneralRe: Append a space to a string... Pin
David Crow28-Jun-06 7:34
David Crow28-Jun-06 7:34 
QuestionFile operations Pin
peruv27-Jun-06 13:08
peruv27-Jun-06 13:08 
QuestionRe: File operations Pin
David Crow28-Jun-06 6:17
David Crow28-Jun-06 6:17 
QuestionAt StartDoc obtain the current printer name Pin
pgibson00770027-Jun-06 12:07
pgibson00770027-Jun-06 12:07 
AnswerRe: At StartDoc obtain the current printer name Pin
Hamid_RT27-Jun-06 19:15
Hamid_RT27-Jun-06 19:15 

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.