GetDlgItemInt doesn't work

Hello,

I have a dialog and a picture control inside of it. During OnInitDialog I try to obtain the text part of the picture control like this

1
2
3
4
CWnd *dialogHandle; // Handle of the dialog
CWnd *itemHandle; // Handle of the picture control
BOOL error;
dialogHandle->GetDlgItemInt(itemHandle->GetDlgCtrlID(), &error, 0);


however GetDlgItemInt function set error to 0 which says there is an error

here is the resource line

CONTROL 65443, IDC_PICTURE, "Static", SS_BITMAP, 13, 13, 40, 40

I want this number 65443
You are not going to get that number like that.

That is the ID of the BITMAP resource that the picture control is showing.

In order to use the GetDlgItemInt funtion on a window control, the window or control has to carry some sort of textbox or caption - because
the GetDlgItemInt function is just a cover for a WM_GETTEXT message.

So GetDlgItemInt can be used on things like editboxes and buttons.


If I find out differently I'll let you know.
Last edited on
thank you,
I exactly want ID of the bitmap and I couldn't find a way to obtain it for days :\
You might not be able to do that - but it is maybe possible to get a handle to the bitmap.

What are you trying to achieve anyway?
closed account (DSLq5Di1)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645478

@guestgulkan
Whoops.. you're right, sorry! I should have read the posts more thoroughly.
Last edited on
@ sloppy9 - That not the issue here is it??
So you have a static control being used to display a bitmap. Are you wanting the ID of the static control or the ID of the bitmap resource? If the latter are you defining BITMAP resources in the same file something like this?

65443 BITMAP "my_bitmap.bmp"
Topic archived. No new replies allowed.