Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

xplo

catching clicks on dialog items in wina32 api

This topic is 6135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
You have to handle WM_COMMAND. You''ll need to use GetDlgItem to retrieve a handle to the object in question.

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!

Share this post


Link to post
Share on other sites
Thanks for the detailed reply. It did help me, but an important thing I forgot to activate is give the static control the "SS_NOTIFY" property. W/o that static controls don''t seem to send WM_COMMAND''s at all when clicked.

Peace Out. [xplo]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!