c++ - Resource conflict on ON_UPDATE_COMMAND_UI -
i have exe class contains button resource id exe_button_resource
on_update_command_ui(exe_button_resource, onupdateexebuttonresource) void exe::onupdateexebuttonresource(ccmdui* pcmdui) { pcmdui->enable(exe_flag); }
this exe application load dll class.
dll class having menu item resource id dll_menu_resource
.
unfortunately, exe_button_resource
, dll_menu_resource
having same resource id. avoid them have conflict id pretty difficult, 2 separate projects.
whenever exe_flag, member exe turn false, affect menu in dll too. clicking on dll_menu_resource
menu have no effect @ all.
how can avoid trap? having manual inspection on resource.h files not option me, 2 separate projects, managed 2 separate teams.
once, thought might resource conflicting problem. hence, in dll code show right clicked menu, have following code load dll resource, , restore exe resource when done.
void dll::oncontextmenu(cwnd* pwnd, cpoint point) { restoredllstate ext; ... }
restoredllstate load global dll resource, , load original resource once done.
restoredllstate::restoredllstate() { m_hinstold = afxgetresourcehandle(); afxsetresourcehandle(g_hdllresource); } restoredllstate::~restoredllstate() { afxsetresourcehandle(m_hinstold); }
that doesn't work. guess that, action enable/disable resource particular id, propagate exe till dll, regardless default resource being loaded currently.
to honest, had posted similar question code project , microsoft.public.vc.mfc, didn't useful comment out there.
check cool tool:
http://www.codeproject.com/kb/macros/resorg.aspx-
another useful post:
mfc resource.h command/message ids
Comments
Post a Comment