What’s new in Orcas for VC++

Channel9 has posted recently an interview with Sarita Bafna, a Program Manager on the VC++ Libraries team, about the new features available in Orcas (in March CTP also) for VC++. The interview is focused on 2 things: marshaling library and MFC updates.

The marshaling library consists on one single API, marshal_as, for marshaling between managed and unmanaged types. For now, it only supports 22 conversion between various string types (from ATL, Windows and STL), but it can be extended by developers. The API has the form:

to = marshal_as<to>(from);

and to marshal from const char* to System::String^ you only have to do this:

const char* str1 = "sample";
String^ str2 = marshal_as<String^>(str1);

If you want the reverse, convert from a String^ to a const char* you need to use a marshal_context object, which keeps track of allocated objects and frees them in the destructor:

marshal_context context;

String^ str1 = gcnew String("sample");
const char* str2 = context.marshal_as<const char*>(str1);

You can read more about this on Nish's blog.

On the other hand, several updates were done to MFC. MFC headers were last updated in 1998, and they were now changed to support all the windows messages created since then. MFC now also supports the controls that were introduced in Windows Vista.

  • you can now hide your menu to offer more space for the client area; hiding and showing is simply available by hitting the ALT key
  • new style dialogs for open and saved: any new application created with Orcas has the Vista style for these dialogs. More over, existing applications rebuilt with Orcas will have these new dialogs under Vista. For the applications running on the previous operating systems, the dialogs will default to the previous style.
  • VC++ toolbox has new controls available: sys link, network address control (supports IPv4, IPv6 and DNS), split button and command button; property dialogs have also been updated for these controls
  • high quality graphics (images, icons, etc.) can be opened, but not edited, in the resource editor: if you want them edited, you can use the "Open in external editor" command from the menu. The default external editor is MS Paint. The preview area of the resource editor shows all the images that are part of an .ico file;
  • all the new apps have UAC enabled by default: in the manifest file there is an additional setting for running the application with the priviledges of the launching process; these settings can be changed from the project Properties > Linker > Manifest: Enable User Accound Control (UAC) (default set to Yes), UAC Execute Level and UAC Bypass UI Protection (default set to False)

So, for all those saying MFC is dead, have a look on the Orcas March CTP and see the contrary!

1 Reply to “What’s new in Orcas for VC++”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.