how can we pass parmaters in callback function

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • how can we pass parmaters in callback function

    Hi,
    How can we pass arguments in callback function.
    for eg,

    //Here how can i pass int a and int b into call back function"_cbfun().
    fun(int a,int b)
    {
    WM_CreateWindow(0, 0 ,xSize, ySize,WM_CF_SHOW|WM_CF_HASTRANS,_cbfun, 0);
    }

    static void _cbfun(WM_MESSAGE *pmsg)
    {

    }

    Regards,
    venkat
  • Hello venkat,

    You can use application-defined messages to send a pointer or int value to the callback function. This can be done using the function WM_SendMessage().

    You can also define extra bytes which can be set and retrieved using the functions WM_SetUserData() and WM_GetUserData().

    Best regards,
    Adrian