none
WS_POPUP and control identifier

    Question

  • static HWND hPopup;
    
    INT_PTR CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
     switch(message)
     {
       case WM_INITDIALOG:
        hPopup = CreateWindowEx(0, WC_LISTBOX, "", WS_POPUP | WS_BORDER | LBS_STANDARD, rc.left, rc.top, rc.right, rc.bottom, hWnd, NULL, hInstance, NULL);
       break;
     }
    }
    

    This is the code I use to create a popup in a dialog. Now the problem is I need to catch WM_COMMAND messages from this popup. Normally i would do this as follows in DlgProc:

    case WM_COMMAND:
     switch(LOWORD(wParam))
     {
       case : //here i would insert the control identifier
        switch(HIWORD(wParam))
        {
         case LBN_SETFOCUS:
         //some code here...
         break;
         case LBN_KILLFOCUS:
         //some code here...
         break;
        }
       break;
     }
    break;
    

    How can I do that? I only have the HWND, as the hMenu argument of CreateWindowEx must be NULL or a valid Menu Handle when using WS_POPUP instead of WS_CHILD. But I wan't no menu...

     

    Thanks for any help

    Friday, February 25, 2011 12:22 PM