| Onega's profileOnegaBlogListsNetwork | Help |
|
|
September 25 ATL, MFC and scoped_anyI am glad to found Achieve More Reliable Resource Management with Our Custom C++ Classes, but when using it in a unit test project, I got weird compile error. The error points to line 238 of scoped_any.h DECLARE_SMART_ANY_TYPEDEFS(scoped) and according to other error message it claims “close_rpc_binding” is not valid. After struggling it turned out to be confliction between ATL and MFC. In an ATL project the source file compiled successfully, but in its corresponding unit test project I have to use MFC because CPPUNIT MFCTestRunner is used to produce GUI. At last the problem was solved by moving MFC related headers from stdafx.h to where they are actually required, and disable precompiled header. There is also a post(Automate Resource Management with shared_ptr) demonstrating resource management via custom deleter and boost::shared_ptr. June 18 Reusing CWinApp derived MFC class in Console applicationOnce I have to integrate a MFC GUI application into a console application. The MFC has a global "theApp" object, but I also want to change something before its ctor was called, so I moved "theApp" from global to local scope, but ctor of CMainFrame reproted error. The trick is to call AfxWinInit after declaring theApp object. { April 03 Code snippet Using WMI via C++/CLI#include "stdafx.h" January 08 VC++ 9.0 Express edition web setupIt depends on proxy settings of IE, but does not understand pac (proxy automatic configuration file) settings. September 06 LoadIcon() failed in Ctor of CDialog derived classOnce I encountered an application that raise runtime error in Ctor of a
CDialog derived class at the following line: m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); After revisiting the program, I found that there is a global variable of this dialog class, this seems to cause initialize sequence problem, then the fix is move above line from Ctor to OnInitDialog(). |
|
|