Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFont problem!choose a font for a Edit Control Pin
Hamid_RT8-Nov-07 20:16
Hamid_RT8-Nov-07 20:16 
QuestionKernel mode: How to open a file with DeletePending? Pin
JHoov1-Nov-07 12:30
JHoov1-Nov-07 12:30 
QuestionCorrect Way to Terminate a Named Pipe Server Pin
Richard Andrew x641-Nov-07 10:13
professionalRichard Andrew x641-Nov-07 10:13 
AnswerRe: Correct Way to Terminate a Named Pipe Server Pin
Mark Salsbery1-Nov-07 11:02
Mark Salsbery1-Nov-07 11:02 
GeneralRe: Correct Way to Terminate a Named Pipe Server Pin
Richard Andrew x641-Nov-07 11:40
professionalRichard Andrew x641-Nov-07 11:40 
GeneralRe: Correct Way to Terminate a Named Pipe Server Pin
Mark Salsbery1-Nov-07 11:47
Mark Salsbery1-Nov-07 11:47 
AnswerRe: Correct Way to Terminate a Named Pipe Server Pin
Llasus1-Nov-07 13:57
Llasus1-Nov-07 13:57 
QuestionPassing pointers to function into another function Pin
acerunner3161-Nov-07 10:04
acerunner3161-Nov-07 10:04 
I'm trying to pass a pointer to a function as an argument to another function, but I am getting compile errors.

class 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);
   void ManageTasks(unsigned char, unsigned char, unsigned char (*)(unsigned char, unsigned char));
};

unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
   ...
}
unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
   ...
}
unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
   ...
}

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

   switch (ptrFunction(1,1))
   {
   case 0:
      //handle results
   case 1:
      //handle results
   }

   ... //unrelated code removed
}


now based on a combobox selection, I will call a different function

void CModule::OnSelchangeCombobox()
{
   switch(m_Combobox->GetCurSel())
   {
   case 0: ManageTask(1,1,FunctTask1); break;
   case 1: ManageTask(1,1,FunctTask2); break;
   case 2: ManageTask(1,1,FunctTask3); break;
   }
}


but i get this error on compile
'ManageTasks' : cannot convert parameter 3 from 'unsigned char (unsigned char,unsigned char)' to 'unsigned char (__cdec<br />
l *)(unsigned char,unsigned char)'


What am I doing wrong? FYI I'm using VC++ 6.0.
AnswerRe: Passing pointers to function into another function Pin
Nemanja Trifunovic1-Nov-07 10:07
Nemanja Trifunovic1-Nov-07 10:07 
GeneralRe: Passing pointers to function into another function Pin
acerunner3161-Nov-07 10:13
acerunner3161-Nov-07 10:13 
AnswerRe: Passing pointers to function into another function Pin
David Crow1-Nov-07 10:44
David Crow1-Nov-07 10:44 
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 
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 

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.