简体   繁体   English

如何获取控件自定义资源数据

[英]How to get a control custom resource data

You can get common controls custom resource data ( see controlData section: http://msdn.microsoft.com/en-us/library/aa380902(v=VS.85).aspx ) by handling WM_CREATE and accesing lpCreateParams member of CREATESTRUCT.您可以通过处理 WM_CREATE 和访问 CREATESTRUCT 的 lpCreateParams 成员来获取通用控件自定义资源数据(参见 controlData 部分: http://msdn.microsoft.com/en-us/library/aa380902(v=VS.85).aspx )。 Is there any way to access the data after a control was created?创建控件后有什么方法可以访问数据吗?

Looks like I found the answer.看来我找到了答案。 We can use FindResource->LoadResource->LockResource functions to get pointer to the dialog resource data.我们可以使用 FindResource->LoadResource->LockResource 函数来获取指向对话框资源数据的指针。 The pointer returned by LockResource will point to DLGTEMPLATEEX structure. LockResource 返回的指针将指向 DLGTEMPLATEEX 结构。 This will allow to iterate through dialog controls to find the needed dialog item ( DLGITEMTEMPLATEEX ) and extract custom resource data from it这将允许遍历对话框控件以找到所需的对话框项 (DLGITEMTEMPLATEEX) 并从中提取自定义资源数据

lpCreateParams is just a pointer to the additional creation parameters, as supplied by the caller. lpCreateParams 只是一个指向调用者提供的附加创建参数的指针。 Its not the data itself.它不是数据本身。

The creator of the window/control would not make any guarantees to keep that data around after creation.窗口/控件的创建者不会保证在创建后保留该数据。

So, no.所以不行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM