Second Stanza

April 30, 2008

VC 6 to VS 2008

Filed under: C and C++ — Tags: , — dfbaskin @ 9:42 am

I was porting a project from Visual Studio 6 so that it would compile under Visual Studio 2005. It was a mixed C/C++ MFC-based project. Of course, the C/C++ compiler has gotten stronger and some older syntax is no longer accepted by default. I found the following definitions helpful in getting the source code compiled:

  • _CRT_SECURE_NO_WARNINGS – This allows me to disable the warnings about not using the new safe functions, instead of the normal unsafe ones, like strcpy. I know, bad idea, but we were just trying to get some legacy code running.
  • _CRT_NONSTDC_NO_WARNINGS – This allows me to disable the warnings about POSIX functions, such as filelength and chdir.
  • _USE_32BIT_TIME_T – time_t is now a 64-bit value, by default. This define allows me to use the old 32-bit value.

One other thing I had to address was the use of the COccManager class. For VC6, this class was not public but it was included in the MFC source code. This knowledgebase article details how to use this class. This technique worked well and gave me the control within the CHtmlView class that I needed to manipulate the functionality of the MSHTML control.

In VS2008, however, this class was made public and the CHtmlView instantiated its own instance of a COccManager class. Now you have to override the CreateControlSite() method in order to make use of your custom COccManager class. Once I made the switch, the CHtmlView object using my custom COccManager worked as I expected.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: