Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionComboBox background problem in CPropertySheet wizard Pin
ewanb18-Aug-06 4:52
ewanb18-Aug-06 4:52 
Questionnot using the UNICODE libs in VS 2005 Pin
Kleser18-Aug-06 4:11
Kleser18-Aug-06 4:11 
QuestionConceptual Question Pin
LCI18-Aug-06 3:55
LCI18-Aug-06 3:55 
AnswerRe: Conceptual Question Pin
charlieg18-Aug-06 4:06
charlieg18-Aug-06 4:06 
AnswerRe: Conceptual Question Pin
Maximilien18-Aug-06 4:45
Maximilien18-Aug-06 4:45 
GeneralRe: Conceptual Question Pin
LCI18-Aug-06 5:13
LCI18-Aug-06 5:13 
GeneralRe: Conceptual Question Pin
BambooMoon18-Aug-06 6:10
BambooMoon18-Aug-06 6:10 
AnswerRe: Conceptual Question Pin
flippydeflippydebop21-Aug-06 12:12
flippydeflippydebop21-Aug-06 12:12 
what about creating a static pointer in the classes that you want to be able to use from any other class/function. then all you need to do is include the header for the class and voila!. For example:


<br />
//// hello.h<br />
<br />
class One<br />
{<br />
public:<br />
   One(void);<br />
   ~One(void);<br />
public:<br />
   void oneFunction();<br />
   int oneX;<br />
<br />
};<br />
<br />
class Two<br />
{<br />
public:<br />
   Two(void);<br />
   ~Two(void);<br />
public:<br />
   static Two* m_ptrTwo; // <-- declare a static pointer to ourself {Two*)<br />
<br />
   void twoFunction();<br />
   int twoX;<br />
};<br />
<br />


and the body...

<br />
//// hello.cpp<br />
<br />
#include "hello.h"<br />
<br />
<br />
Two*Two::m_ptrTwo = NULL;  // <-- define the static pointer for class Two here.. set it to NULL<br />
<br />
// constructor for class Two<br />
Two::Two(void)<br />
{<br />
   m_ptrTwo = this; // <-- setup the pointer to point to.... itself!!!<br />
}<br />
<br />


Now we can use the pointer 'm_ptrTwo' to call anything in the public interface of the class Two. For example:

<br />
One::oneFunction()<br />
{<br />
   // Now here we will use the pointer from class Two to call anything in the public interface.<br />
   Two::m_ptrTwo->twoFunction();<br />
   Two::m_ptrTwo->twoX = 1234;<br />
}<br />
<br />

QuestionWhy do some people use HeapAlloc instead of malloc? Pin
Chintoo72318-Aug-06 3:48
Chintoo72318-Aug-06 3:48 
AnswerRe: Why do some people use HeapAlloc instead of malloc? Pin
bob1697218-Aug-06 4:25
bob1697218-Aug-06 4:25 
AnswerRe: Why do some people use HeapAlloc instead of malloc? Pin
Andy Moore18-Aug-06 7:02
Andy Moore18-Aug-06 7:02 
GeneralRe: Why do some people use HeapAlloc instead of malloc? Pin
Chintoo72318-Aug-06 7:18
Chintoo72318-Aug-06 7:18 
GeneralRe: Why do some people use HeapAlloc instead of malloc? Pin
Andy Moore18-Aug-06 7:19
Andy Moore18-Aug-06 7:19 
AnswerRe: Why do some people use HeapAlloc instead of malloc? Pin
cmk18-Aug-06 11:31
cmk18-Aug-06 11:31 
QuestionCreating a Crystal report using a predifined template with vc++ 6.0 Pin
SabseJugs18-Aug-06 3:38
SabseJugs18-Aug-06 3:38 
Questionproblem with refresh button!! Pin
vijay_aroli18-Aug-06 3:34
vijay_aroli18-Aug-06 3:34 
AnswerRe: problem with refresh button!! Pin
Rage18-Aug-06 3:39
professionalRage18-Aug-06 3:39 
QuestionRe: problem with refresh button!! Pin
vijay_aroli18-Aug-06 5:02
vijay_aroli18-Aug-06 5:02 
QuestionRe: problem with refresh button!! Pin
David Crow18-Aug-06 6:33
David Crow18-Aug-06 6:33 
NewsRe: problem with refresh button!! Pin
vijay_aroli18-Aug-06 21:19
vijay_aroli18-Aug-06 21:19 
QuestionWord automation Pin
great_tommy18-Aug-06 3:31
great_tommy18-Aug-06 3:31 
AnswerRe: Word automation Pin
Rage18-Aug-06 3:38
professionalRage18-Aug-06 3:38 
GeneralRe: Word automation [modified] Pin
great_tommy18-Aug-06 3:50
great_tommy18-Aug-06 3:50 
GeneralRe: Word automation Pin
David Crow18-Aug-06 6:36
David Crow18-Aug-06 6:36 
QuestionHow Pin
nhoc_conxauxi18-Aug-06 2:58
nhoc_conxauxi18-Aug-06 2:58 

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.