I'm pretty new to all this programming stuff especially winapi. Well to get to it I was wondering if it is possible in c and winapi to call different functions by clicking the item text in a listbox. Sort of like using a list box as a menu. I found this code:

Code:
WORD wNotify; /* notification code */
WORD wID; /* control id */
HWND hCntrl; /* control handle */
int nSelection; /* zero-based index of selected listbox item */
int nLen; /* listbox item number of TCHARS (ie str length) */
TCHAR *chBuffer; /* for listbox item text */
wID=LOWORD(wParam);
wNotify=HIWORD(wParam);
hCntrl=(HWND)lParam;
if (hCntrl && wNotify==LBN_SELCHANGE && wID==IDLISTBOX)
{
nSelection=SendMessage(hCntrl, LB_GETCURSEL, 0, 0);
nLen=SendMessage(hCntrl, LB_GETTEXTLEN, nSelection, 0);
chBuffer=(TCHAR*)malloc((nLen+1)*sizeof(TCHAR));

if (chBuffer)
{
SendMessage(hCntrl, LB_GETTEXT, nSelection, (LPARAM)chBuffer);
/* 'hEdit' is handle to edit control*/

SetWindowText(hwnd,chBuffer);

free(chBuffer);
}
}
It just changes the window text to the selected item text, something like this could be useful to me now. If anyone could help me out with this, or recommend a tutorial or sample code. It would be appreciated.

Thanks.