Click here to Skip to main content
15,887,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Communication Between EXEs Pin
PJ Arends11-Jan-06 21:58
professionalPJ Arends11-Jan-06 21:58 
QuestionCreate Font to match Dialogue Box Pin
LittleYellowBird11-Jan-06 21:17
LittleYellowBird11-Jan-06 21:17 
AnswerRe: Create Font to match Dialogue Box Pin
Owner drawn11-Jan-06 21:51
Owner drawn11-Jan-06 21:51 
GeneralRe: Create Font to match Dialogue Box Pin
LittleYellowBird12-Jan-06 4:32
LittleYellowBird12-Jan-06 4:32 
QuestionFunction as argument Pin
kk.tvm11-Jan-06 20:35
kk.tvm11-Jan-06 20:35 
AnswerRe: Function as argument Pin
Owner drawn11-Jan-06 20:44
Owner drawn11-Jan-06 20:44 
AnswerRe: Function as argument Pin
Zdeslav Vojkovic11-Jan-06 20:47
Zdeslav Vojkovic11-Jan-06 20:47 
AnswerRe: Function as argument Pin
Cedric Moonen11-Jan-06 20:48
Cedric Moonen11-Jan-06 20:48 
You don't pass a function name as argument as another function but rather a pointer to a function:

First, you have to describe what is the 'type' of the function, for example:
typedef void (MyFunc*) (int,int);

This is a typedef that says that MyFunc is a type definition of a function returning nothing (the first void before (MyFunc*) ) and that takes two integer arguments (the argument list is specified after (MyFunc*) ).

Then, you can use MyFunc as a standard argument to a function:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
}


This explain that the Do function will receive a pointer to a function of the type MyFunc as argument.

Inside your Do function, when you want to call your function, simply do that:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
    int a=0,b=0;<br />
    MyFuncThatWillBePassed(a,b);<br />
}



Warning: you have to respect of course the type of the function and so you NEED to pass two integers (in our case) to your function otherwise you will have compile errors.

Hope this helps
GeneralRe: Function as argument Pin
Zdeslav Vojkovic11-Jan-06 21:06
Zdeslav Vojkovic11-Jan-06 21:06 
GeneralRe: Function as argument Pin
Cedric Moonen11-Jan-06 21:13
Cedric Moonen11-Jan-06 21:13 
GeneralRe: Function as argument Pin
kk.tvm11-Jan-06 20:56
kk.tvm11-Jan-06 20:56 
QuestionSticky Windows? Pin
S Douglas11-Jan-06 20:25
professionalS Douglas11-Jan-06 20:25 
AnswerRe: Sticky Windows? Pin
Rage11-Jan-06 22:34
professionalRage11-Jan-06 22:34 
GeneralRe: Sticky Windows? Pin
S Douglas11-Jan-06 22:43
professionalS Douglas11-Jan-06 22:43 
QuestionDBF file usage Pin
<color>Aljechin 11-Jan-06 19:55
<color>Aljechin 11-Jan-06 19:55 
AnswerNo Pin
__yb13-Jan-06 12:15
__yb13-Jan-06 12:15 
QuestionCan a BHO do this? Pin
Chintoo72311-Jan-06 19:18
Chintoo72311-Jan-06 19:18 
AnswerRe: Can a BHO do this? Pin
__yb13-Jan-06 12:18
__yb13-Jan-06 12:18 
Questiontry/catch - getting line number Pin
Chintoo72311-Jan-06 19:09
Chintoo72311-Jan-06 19:09 
AnswerRe: try/catch - getting line number Pin
__yb13-Jan-06 12:22
__yb13-Jan-06 12:22 
AnswerRe: try/catch - getting line number Pin
Shraddhan25-Jan-06 13:09
Shraddhan25-Jan-06 13:09 
GeneralRe: try/catch - getting line number Pin
Chintoo72325-Jan-06 15:18
Chintoo72325-Jan-06 15:18 
GeneralRe: try/catch - getting line number Pin
Shraddhan25-Jan-06 15:38
Shraddhan25-Jan-06 15:38 
QuestionVisual C++ Shortcut Keys Pin
romuzu11-Jan-06 18:59
romuzu11-Jan-06 18:59 
AnswerRe: Visual C++ Shortcut Keys Pin
Owner drawn11-Jan-06 19:08
Owner drawn11-Jan-06 19:08 

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.