PDA

Click to See Complete Forum and Search --> : Doesn't anybody know? CBEM_SETIMAGELIST and SendMessage problems


dubae524
Jul 2nd, 2001, 08:09 PM
I guess I need to be more descriptive. I am using mainly the SendMessage API function and the CBEM_SETIMAGELIST constant in order to attach an ImageList to my API-created ComboBoxEx (aka "ImageCombo") control. Here are the declarations:


Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long

WM_USER = &H400
CBEM_SETIMAGELIST = (WM_USER + 1)

ImgList is the ImageList, and CmboEx is the ComboBoxEx (aka "ImageCombo") handler. Here is the code:


SendMessage CmboEx, CBEM_SETIMAGELIST, 0, ImgList

Can somebody please tell me what I am doing wrong? I am just having a hard time figuring it out!

dubae524
Jul 3rd, 2001, 06:57 PM
Doesn't anybody know how to answer my question?

Yonatan
Jul 4th, 2001, 11:21 AM
Is ImgList an ImageList from the Common Controls OCX, or one that you created through the API?
If you created it with the API then I don't see a problem with your code, but if it's from the OCX, you'll need to do this:
SendMessage CmboEx, CBEM_SETIMAGELIST, 0, ByVal ImgList.hImageList

Hope this helps :rolleyes:

Yonatan
Jul 4th, 2001, 11:24 AM
Oh wait, one more thing that I just noticed:
You said that CBEM_SETIMAGELIST = (WM_USER + 1)... Well, it should be WM_USER + 2.
Oh well :rolleyes:

dubae524
Jul 4th, 2001, 11:54 AM
Thank you so much!!! It works, too! Thank you!