Visual C++ (MFC)

Create Callback Function

The callback function has the following format. You can specify any name for this function.

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

You can also add functions by using the .NET integrated environment.

In [Class View], right-click on the class to which you want to add an event message routine.
Then select [Add]-[Add Function]. The [Add Member Function Wizard] dialog is displayed.
Create the function according to the following procedure.

[Access]

public

[Return type]

long _stdcall

[Function name]

CallBackProc

[Parameter type]

short

[Function name]

Id

[Add]

Click

[Parameter type]

short

[Function name]

Message

[Add]

Click

[Parameter type]

WPARAM

[Function name]

wParam

[Add]

Click

[Parameter type]

LPARAM

[Function name]

lParam

[Add]

Click

[Parameter type]

void *

[Function name]

Param

[Add]

Click

[Static]

Check

Confirm that the declaration of function is as follows, and click the [Finish] button.

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

The wizard declares the function prototype and creates the skeleton.