关于在dll中动态创建按钮的有关问题

关于在dll中动态创建按钮的问题


我希望在dll中动态创建一股button,然后提供给调用这个dll的exe文件使用,我在exe文件中获得dll的指针,通过这个指针来调用动态创建button的函数,但是每当create按钮的时候,程序就报assert错误,这是怎么回事啊,高手帮忙看看怎么解决这个问题,谢谢啦!!

我是新手,分数不多,请大家原谅啊

------解决方案--------------------
By default, MFC uses the resource handle of the main application to load the resource template. If you have an exported function in a DLL, such as one that launches a dialog box in the DLL, this template is actually stored in the DLL module. You need to switch the module state for the correct handle to be used. You can do this by adding the following code to the beginning of the function:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.