Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - Improving MFC for Windows Vista
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Improving MFC for Windows Vista
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-02-18

    Table of Contents:
  • Improving MFC for Windows Vista
  • First Impressions
  • The Open/Save Dialog
  • Final Thoughts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Improving MFC for Windows Vista - First Impressions


    (Page 2 of 4 )

    For a start let’s examine how a simple project made by Visual Studio 2005 looked. We will ignore any improvements offered by Vista itself as we are only interested in what changes are brought by Visual Studio 2008 itself, not what additions will automatically be implemented by the Vista OS. To test this I used Vista Ultimate Edition with some custom styling based on the Aero Interface.


    -> Basic with VS2005 under Vista <-


    -> Basic with VS2008 under Vista <-


    Remember that all we did was recompile the source code after Studio converted the solution from version 8 to 9. The first and only obvious change added to it is the toolbar, which takes the Systems style with the version 9 compiler.

    Also, the new version offers the option of using higher-quality icons, giving a 48X48 resolution and two versions, 8 bits or 24 bits. This way the icons will look nicer on those high resolution computers we all tend to have these days.

    Basically this is all you can squeeze from this part with just a recompile. It's not much, however I’m sure you observed that IE 7 and the new Media Player from Microsoft don't have the menu bar on by default. It just pops up once you push the ALT key.

    This little trick can be implemented easily with one line of code in any SDI application. The reason these work for SDI only is that the Visual C++ developing team found that it was unclear what should happen with a MDI application with the child Windows close/minimize/maximize button as Sarita Banta expressed in a forum post over the MSDN forum.

    Additionally “most of the MDI apps have complex menus and Vista UX guidelines do not encourage hiding complex menu bars.” So this function has been overwritten in the MDI-based application, so if you pass any argument other than "keep always on" you’ll get an assertion failure.

    The argument I’m talking about is AFX_MBV_KEEPVISIBLE, which tells the compiler to maintain the old-style menu and will be applied by default. The argument can also be set to AFX_MBV_DISPLAYONFOCUS (for ALT toggle of the menu bar) andAFX_MBV_DISPLAYONF10 (for an F10 key toggle). Of course these can be combined by applying a bitwise or operation.

    All you have to do is call the:


    virtual void SetMenuBarVisibility( DWORD nStyle );


    Like this for an ALT toggle:


    SetMenuBarVisibility(AFX_MBV_DISPLAYONFOCUS);


    To go from a window like this compiled under VS 8.0:



    To a more stylish:



    Or even a less busy version if we deactivate the toolbar also… see below.



    One more tip: you may want to make sure to use the Clear Type technology implemented in Vista. This allows you to use anti-aliasing on the fonts for a more stylish feeling to them, and also to make sure that some texts (mainly in Dialogs) don’t look slightly off.

    To do so you only need to use a font that supports anti-aliasing. Just about any free types that use bitmap images can be applied to it, but to make sure they are a little more synchronized with the system, choose the Use System font in the dialogs Properties window.:


    This will lead to getting the current system that is saved under the registry key in the:HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsNTCurrentVersion FontSubstitutes path. With a Vista with English installation this will be Microsoft Sans Serif.

    More Windows Scripting Articles
    More By Gabor Bernat


     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek