开发者

TabControl not working with VS2010

开发者 https://www.devze.com 2023-03-19 09:42 出处:网络
I recently upgraded a VC++ project from 2005 to 2010, everything works fine except the resources. I have a tab control with 2 pages, all dialogs in the same resource file, the TabControl is found and

I recently upgraded a VC++ project from 2005 to 2010, everything works fine except the resources. I have a tab control with 2 pages, all dialogs in the same resource file, the TabControl is found and displayed, but the pages all fails to load (the common _AfxCheckDialogTemplate() error).

This is very strange as all dialog are in the same file. I've set the AfxSetResourceHandle() to the correct value.

I've done a few tests with the following result: - Loading the property page directly with DoModal: fails on DDX_Text() on first control. - Loading a newly-created PPage with DoModal: ok ! - Loading the same PPage in TabControl: fails on AfxSetResourceHandle() - Loadding the new PPage in TabControl: also fails.

As said before, the project was simply migrated from VS2005 and it was working nicely. I also changed my host from XP 32 to Seven 64bits, but I guess the pb is more likely related to the way resources are handled in VS. I remember having lots of pro开发者_JAVA百科blems with that already, especially if you use common resources with includes.

Any idea about what to try now ? Is there some issue with TabControls in VS2010 ? I've googled a lot but not found anything interesting so far. Is there another way to migrate resources from a VS2005 project ? Recreating all the resources would be quite long. Should I simply revert to VS2005 ?

Thanks for any tips,

Alain


Maybe the migration to 64-bits is causing one or more controls on your property page to 'fail-create'. Normally this should be reported by CPropertySheet::Create() by returning FALSE. If you get to your WM_INITDIALOG handler, which happens when you display a page with DoModal(), the DDX_Control function fails, which means the first control could not be created, and that's a serious error. Look up the discussion on InitCommonControlsEx() in MSDN and see wether your application calls it correctly.


Pb finally corrected: created a new .rc file and copied all resources one by one by drag and drop. Seems the pb was that the migration from 2005 to 2010 failed (at first try it was even impossible to open the resource in the editor!). This is a quite old project migrated first from VC6 and containing included resource files. Maybe VS not very good at handling this... Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号