Click here to Skip to main content
15,889,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing pointers to function into another function Pin
acerunner3161-Nov-07 11:43
acerunner3161-Nov-07 11:43 
GeneralRe: Passing pointers to function into another function Pin
David Crow1-Nov-07 12:13
David Crow1-Nov-07 12:13 
GeneralRe: Passing pointers to function into another function Pin
acerunner3161-Nov-07 12:22
acerunner3161-Nov-07 12:22 
GeneralRe: Passing pointers to function into another function Pin
David Crow2-Nov-07 2:43
David Crow2-Nov-07 2:43 
AnswerRe: Passing pointers to function into another function Pin
Mark Salsbery1-Nov-07 11:04
Mark Salsbery1-Nov-07 11:04 
AnswerRe: Passing pointers to function into another function Pin
Randor 1-Nov-07 11:44
professional Randor 1-Nov-07 11:44 
GeneralRe: Passing pointers to function into another function [modified] Pin
acerunner3161-Nov-07 12:06
acerunner3161-Nov-07 12:06 
AnswerRe: Passing pointers to function into another function [modified] Pin
Stephen Hewitt1-Nov-07 14:35
Stephen Hewitt1-Nov-07 14:35 
Modify the class as follows:
CModule : public CDialog
{
// Construction
public:
   CModule (CWnd* pParent = NULL); // standard constructor
...
private:
   unsigned char FunctTask1(unsigned char, unsigned char);
   unsigned char FunctTask2(unsigned char, unsigned char);
   unsigned char FunctTask3(unsigned char, unsigned char);
   typedef unsigned char (CModule::*PFunctTask_t)(unsigned char, unsigned char);
   void ManageTasks(unsigned char, unsigned char, PFunctTask_t);
};

void CModule ::ManageTasks(unsigned char Param1, unsigned char Param2, unsigned char (*ptrFunct)(unsigned char, unsigned char)
{
   ... //unrelated code removed

   switch ((this->*ptrFunction)(1,1))
   {
   case 0:
      //handle results
   case 1:
      //handle results
   }

   ... //unrelated code removed
}


And modify the calls like this:
void CModule::OnSelchangeCombobox()
{
   switch(m_Combobox->GetCurSel())
   {
   case 0: ManageTask(1, 1, &CModule::FunctTask1); break;
   case 1: ManageTask(1, 1, &CModule::FunctTask2); break;
   case 2: ManageTask(1, 1, &CModule::FunctTask3); break;
   }
}



-- modified at 20:49 Thursday 1st November, 2007

Steve

QuestionSimple FTP Client Pin
dellthinker1-Nov-07 9:26
dellthinker1-Nov-07 9:26 
AnswerRe: Simple FTP Client Pin
JudyL_MD1-Nov-07 10:20
JudyL_MD1-Nov-07 10:20 
AnswerRe: Simple FTP Client Pin
Peter Weyzen1-Nov-07 16:24
Peter Weyzen1-Nov-07 16:24 
GeneralRe: Simple FTP Client Pin
dellthinker1-Nov-07 17:07
dellthinker1-Nov-07 17:07 
GeneralRe: Simple FTP Client Pin
Peter Weyzen1-Nov-07 20:30
Peter Weyzen1-Nov-07 20:30 
GeneralRe: Simple FTP Client Pin
dellthinker2-Nov-07 6:53
dellthinker2-Nov-07 6:53 
GeneralRe: Simple FTP Client Pin
Peter Weyzen2-Nov-07 7:32
Peter Weyzen2-Nov-07 7:32 
GeneralRe: Simple FTP Client Pin
Bram van Kampen2-Nov-07 3:22
Bram van Kampen2-Nov-07 3:22 
QuestionWizard 2000 Style Wizard Pin
Larry Mills Sr1-Nov-07 7:14
Larry Mills Sr1-Nov-07 7:14 
QuestionCan I pass through a variable number of arguments to another function? Pin
jp-mocs1-Nov-07 6:25
jp-mocs1-Nov-07 6:25 
AnswerRe: Can I pass through a variable number of arguments to another function? Pin
Luc Pattyn1-Nov-07 7:12
sitebuilderLuc Pattyn1-Nov-07 7:12 
AnswerRe: Can I pass through a variable number of arguments to another function? Pin
Chris Losinger1-Nov-07 7:50
professionalChris Losinger1-Nov-07 7:50 
GeneralRe: Can I pass through a variable number of arguments to another function? Pin
jp-mocs1-Nov-07 12:17
jp-mocs1-Nov-07 12:17 
GeneralRe: Can I pass through a variable number of arguments to another function? Pin
jp-mocs2-Nov-07 5:44
jp-mocs2-Nov-07 5:44 
QuestionOn selection a word in CEdit, which messages windows return? Pin
Gofur Halmurat1-Nov-07 6:19
Gofur Halmurat1-Nov-07 6:19 
AnswerRe: On selection a word in CEdit, which messages windows return? Pin
Maximilien1-Nov-07 6:23
Maximilien1-Nov-07 6:23 
GeneralRe: On selection a word in CEdit, which messages windows return? Pin
Gofur Halmurat1-Nov-07 6:34
Gofur Halmurat1-Nov-07 6:34 

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.