有没有办法获取日期时间选择器(DTP)中输入字段的句柄? [英] Is there a way to get the handle of the entry field in a date time picker (DTP)?

查看:131
本文介绍了有没有办法获取日期时间选择器(DTP)中输入字段的句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过发送 DTM_GETDATETIMEPICKERINFO 消息而获得的 DATETIMEPICKERINFO 结构具有字段 hwndEdit 这可能就是我要寻找的。但是,我总是得到 NULL ,所以我想知道它的实际含义是什么。如果没有,是否可以获取输入字段的句柄?

The DATETIMEPICKERINFOstructure obtained by sending the DTM_GETDATETIMEPICKERINFOmessage has a field hwndEdit which might be what I'm looking for. However, I'm getting always NULL for it so I'm wondering what's its actual meaning. If not, is there a way to get the handle of the entry field?

推荐答案

hwndEdit 仅在控件具有 DTS_APPCANPARSE 样式,然后用鼠标单击日期文本(我用 OutputDebugString 和一个计时器对此进行了测试)。编辑控件是动态创建和销毁的。 hwndUD 句柄仅在设置 DTS_UPDOWN hwndDropDown 仅在下拉菜单可见时有效。

hwndEdit only seems to be valid when the control has the DTS_APPCANPARSE style and you click the date text with the mouse (I tested this with OutputDebugString and a timer). The edit control is created and destroyed dynamically. The hwndUD handle is only valid if DTS_UPDOWN is set and the hwndDropDown is only valid while the dropdown is visible.

文档中未对其进行调用,但 DTM_GETDATETIMEPICKERINFO 标记为Vista +,这通常意味着该功能仅在ComCtl32 v6中实现,因此还必须确保您有一个要求使用此版本的清单。

It is not called out in the documentation but DTM_GETDATETIMEPICKERINFO is marked Vista+ and this often means the feature is only implemented in ComCtl32 v6 so you also have to make sure you have a manifest that requests this version.

要更改颜色,可以尝试 DTM_SETMCCOLOR ,但是只有 MCSC_BACKGROUND 被记录为在激活视觉样式时起作用。

To change the color you can try DTM_SETMCCOLOR but only MCSC_BACKGROUND is documented to work when Visual Styles are active.

这篇关于有没有办法获取日期时间选择器(DTP)中输入字段的句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆