Visual C++ (MFC)

Creating Callback Function

The prototype declaration of the callback function has the following format. You can specify any function name.

static void _stdcall CallBackProc(short Id, WPARAM wParam, LPARAM lParam, void *Param);

 

Add functions in Visual Studio integrated environment

The function can be added by using Visual Studio integration environment.

In [Class View], right-click on the class to which you want to add the callback function.
Then choose [Add-Add Function]. The [Add Member Function Wizard] dialog box is displayed.
Please create the function using the following steps.

[Access]

public

[Return type]

void _stdcall

[Function name]

CallBackProc

[Parameter type]

short

[Parameter name]

Id

[Add]

Click

[Parameter type]

WPARAM

[Parameter name]

wParam

[Add]

Click

[Parameter type]

LPARAM

[Parameter name]

lParam

[Add]

Click

[Parameter type]

void *

[Parameter name]

Param

[Add]

Click

[Static]

Check

Click the [Finish] button after confirming that Function signature is as follows.

static void _stdcall CallBackProc(short Id, WPARAM wParam, LPARAM lParam, void *Param);

The prototype declaration and skeleton for the function are created by using the Visual Studio wizard.