Click here to Skip to main content
15,905,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionC++ Multiple inheritance Pin
ScotDolan14-May-07 4:46
ScotDolan14-May-07 4:46 
QuestionRe: C++ Multiple inheritance Pin
David Crow14-May-07 4:54
David Crow14-May-07 4:54 
AnswerRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 4:59
ScotDolan14-May-07 4:59 
AnswerRe: C++ Multiple inheritance Pin
jhwurmbach14-May-07 4:59
jhwurmbach14-May-07 4:59 
AnswerRe: C++ Multiple inheritance Pin
Cedric Moonen14-May-07 5:04
Cedric Moonen14-May-07 5:04 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 5:14
ScotDolan14-May-07 5:14 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 5:14
ScotDolan14-May-07 5:14 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 7:41
ScotDolan14-May-07 7:41 
Cédric,
I miss spoken, the virtual keyword did make the code compile but it still did not function as as expected.
I want to achieve the following functionality of having two ClxThread base objects using inheritence. I basiclly develop a ClxThread class object that provides all the functionaliy to create, kill, suspend, and start a Thread function. I now realize my design decision of making clxthread as base class was probably not the best idea. However, it does make it easy to turn any class into a little worker class/app. Is thare any way i can achieve my desire results.

Desire Results Actual Results
ClxThread                                 ClxThread     
   \                                         /  \                                     
    \                                       /    \
     \                                     /      \      
    Poll    ClxThread                    Poll      |
      \      /                             \      /
       \    /                               \    /
        \  /                                 \  /
       mainloop                            mailoop





Here is the header for the clx thread class
<br />
<br />
class ClxThread<br />
{<br />
public:<br />
	ClxThread();<br />
	virtual ~ClxThread();<br />
<br />
	typedef unsigned (__stdcall *PTHREADFUNC)(void *);<br />
	//Thread Management<br />
	bool CreateNewThread(void);<br />
	bool CreateNewThread(PTHREADFUNC pThreadFunc);<br />
	bool Wait(); //Wait for thread to end<br />
	bool Suspend(); //Suspend the thread<br />
	bool Resume(); //Resume a suspended thread<br />
	bool Kill(); //Terminate a thread<br />
	bool IsActive(); //Check for activity<br />
<br />
	//override these functions in the derived class<br />
	virtual void ThreadEntry(){ }<br />
	virtual void ThreadExit(){ }<br />
	virtual void ThreadRun(){ }<br />
<br />
	//a friend<br />
	//friend DWORD WINAPI _ThreadFunc(LPVOID  pvThread);<br />
	static UINT  WINAPI _ThreadFunc(LPVOID pParam);<br />
<br />
public:<br />
	HANDLE m_hThread;	// Thread handle<br />
	UINT   uiThreadId;	//<br />
<br />
	bool m_bActive; //activity indicator<br />
	DWORD m_lpId; //Thread ID<br />
};


Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures

GeneralRe: C++ Multiple inheritance Pin
Cedric Moonen14-May-07 7:52
Cedric Moonen14-May-07 7:52 
GeneralRe: C++ Multiple inheritance Pin
ScotDolan14-May-07 8:26
ScotDolan14-May-07 8:26 
GeneralRe: C++ Multiple inheritance Pin
Mark Salsbery14-May-07 8:18
Mark Salsbery14-May-07 8:18 
GeneralRe: Mark Has a, Does a, Where is a, Pin
ScotDolan14-May-07 8:35
ScotDolan14-May-07 8:35 
GeneralRe: Mark Has a, Does a, Where is a, Pin
Mark Salsbery14-May-07 9:01
Mark Salsbery14-May-07 9:01 
GeneralRe: Mark Has a, Does a, Where is a, Pin
led mike14-May-07 9:39
led mike14-May-07 9:39 
GeneralThe purpose of the thread class Pin
ScotDolan14-May-07 10:56
ScotDolan14-May-07 10:56 
QuestionRe: The purpose of the thread class Pin
Mark Salsbery14-May-07 11:16
Mark Salsbery14-May-07 11:16 
GeneralRe: The purpose of the thread class Pin
led mike14-May-07 12:33
led mike14-May-07 12:33 
GeneralRe: The purpose of the thread class Pin
ScotDolan15-May-07 3:26
ScotDolan15-May-07 3:26 
GeneralRe: The purpose of the thread class Pin
led mike15-May-07 5:43
led mike15-May-07 5:43 
AnswerRe: The purpose of the thread class Pin
ScotDolan15-May-07 6:14
ScotDolan15-May-07 6:14 
GeneralRe: The purpose of the thread class Pin
led mike15-May-07 7:04
led mike15-May-07 7:04 
AnswerRe: C++ Multiple inheritance Pin
led mike14-May-07 8:01
led mike14-May-07 8:01 
QuestionNetwork Machines Pin
rw10414-May-07 4:33
rw10414-May-07 4:33 
AnswerRe: Network Machines Pin
led mike14-May-07 4:47
led mike14-May-07 4:47 
GeneralRe: Network Machines Pin
rw10414-May-07 5:01
rw10414-May-07 5:01 

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.