Passing Data by Messages

Every message has three parameters: nMsg, wParam and lParam in the following definition of your message callback (this is called a window procedure, but is nothing but a callback!)

LRESULT WINAPI MyWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

The message value which List & Label uses can be queried by LlGetNotificationMessage(). If the default setting is not suitable for your purposes (by definition a unique value) another can be chosen with LlSetNotificationMessage().

wParam is once again our function index and lParam points to an intermediate structure of the type scLlCallback:

struct scLlCallback
{
       int     _nSize;
       LPARAM  _lParam;
       LRESULT _lResult;
       UINT_PTR _lUserParameter;
}

The necessary _lParam (as parameter value) and _lResult (as return value) are stored in this structure.

nLLMessage = LlGetNotificationMessage(hJob);
//....
//...in the window procedure...
if (wMsg == nLLMessage)
{
       PSCCALLBACK     pSC;
       PSCLLTABLEFIELD pSCF;

       pSC = (PSCCALLBACK)lParam;
       switch (wParam)
       {
                case LL_CMND_TABLEFIELD:
                        pSCF = (PSCLLTABLEFIELD)pSC->_lParam;
                        // do something;
                        pSC._lResult = 0;
                        break;
       }
}

_lUserParam is the value passed by

LlSetOption(hJob, LL_OPTION_CALLBACKPARAMETER, <value>)

This can be used to store an object pointer ("this", "self") in object-oriented languages.

When no special return value is needed, the _lResult field doesn't need to be changed, as it is set to 0 by default.