catching clicks on dialog items in wina32 api
Hi,
I''m quite new to window/dialog coding directly in the win32 API but so far I''ve enjoyed exploring it a lot. However I''m at a point that I can''t get past:
How do I catch clicks on certain items (not buttons) in a dialog callback function?
I''ve tried if the items send a WM_COMMAND just like buttons but they don''t seem to.
I also tried somehow getting the WM_MBUTTONDOWN coordinates to be checked against the Positions of the objects but I can''t figure out how to get the coordinates of the items.
The particular thing I''m trying to do is simply catching all clicks on a "picture control" (static, type frame) and executing stuff on clicks.
Any hints on what I could do?
Peace Out. [xplo]
You have to handle WM_COMMAND. You''ll need to use GetDlgItem to retrieve a handle to the object in question.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
case WM_COMMAND:{ long code = HIWORD(wParam); // notification code long ID = LOWORD(wParam); // item/control/accelerator id if(code) // message is from an accelerator { } else // message is from a menu/control { HWND hctrl = (HWND)lParam; // control handle switch(ID) { case DLG_ITEM: // whatever DLG_ITEM actually is { HWND hitem = GetDlgItem(hctrl, ID); // do your thang } break; // other cases } }}return 0;
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement