Monday, January 3, 2011

Converting Old Visual Studio 8 Projects to VS 9 -- ActiveX controls

While converting an older project to Visual Studio 9 I came across a perplexing situation.  In the initialization of one of the dialogs, an Unhandled Exception : Access Violation was encountered in the mfc90 library source file dlgcore.cpp in the CDialog::HandleInitDialog(WPARAM, LPARAM) function. The problem was when that CWnd function's statement,
m_pCtrlCont->m_pSiteFocus = NULL;, was called m_pCtrlCont was NULL.
After doing some debugging and digging around in CWnd code, I found that
m_pCtrlCont was supposed to be initialized in advance by a call to the MFC function
BOOL CWnd::InitControlContainer(BOOL bCreateFromResource);
because of its use of an ActiveX control. Apparently this is something that didn't always happen in old code but is now a problem. When later built with the new libraries, a window that contained an ActiveX control would cause a crash at run-time.
The fix was simply a matter of adding a call to

InitControlContainer(TRUE); in my ActiveX control containing window's OnCreate event.



Sunday, November 21, 2010

Web hosting

I recently needed to get one of my projects going on a decent server for testing.  I looked around and found Webfaction.com.  So far its working out well.   They allow you to install applications that you need in your home directory. They also have the usual web software like Drupal and Joomla.  I use a lot of Python and have installed a bunch of packages in my home lib folder using easy_install.  They actually have a bunch of useful libs already available.  The gcc compiler and tools are readily available and Webfaction.com let you build and install more apps (in your home directory). MySQL and Postgresql are available too.
Check em out.  www.webfaction.com or just sign up here.

Friday, September 10, 2010

Regular expression tool

I came across a very useful tool while trying to design a regular expression. Its called RexExr and its by Grant Skinner of gskinner.com.


http://gskinner.com/RegExr/

One feature I really liked is when hovering over the matches that are hilited in the sample text, it shows a tooltip box with the full matched string and each capture group.