BrainDump
  Home arrow BrainDump arrow Page 4 - The Resource View of the MFC
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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? 
BRAINDUMP

The Resource View of the MFC
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-03-26

    Table of Contents:
  • The Resource View of the MFC
  • Menu Editing
  • Dialog Boxes
  • Toolbar, Hot-Keys and Icons
  • Epilogue

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    The Resource View of the MFC - Toolbar, Hot-Keys and Icons
    (Page 4 of 5 )

    It is quite annoying to search the Data Options and Enter Data menu, so maybe we can speed up the process a little. The solution to our problem is the Toolbar. The Toolbar already contains a few icons, like Cut, Copy, Paste, and so forth. The only thing left to do is add our own. Select the IDR_MAINFRAME toolbar in the resource view and you can add another after the help icon (question mark). Just push down and after that, play a little with the colors and draw your fancy pictogram.

    Assigning the icon with the Data Enter... menu is done by linking the icon to the menus ID. Search in Properties for what ID the Enter Data... menu has and add the same ID to the icon. If you've followed this tutorial, the corresponding ID is ID_DATAOPTION_ENTERDATA. You can see this in the attached screen shot below.




    That's all we need to do. From now on, starting the program and pressing the icon is the same as searching for the option in the menu. Future improvements can be made by assigning a Hot-Key to the application. To do this, visit the Accelerator part of the Resource and add the desired Hot-Key for the corresponding ID. For the Dialog Bar, we'll add the Ctrl+F5 accelerator. Do the following; the interface is intuitive so you can figure out any other combination.



    Finally, we can also advocate the addition of an accelerator key for aesthetics and other obvious reasons by modifying the caption of our menu in the Properties page to this: "&Enter Data..tCtrl + F5". The important part is adding the t in the text.

    Modifying the icon of your application is simply drawing an image for the document type icon or the applications icon. Just search the Icon section in the menu and modify IDR_MAINFRAME for the application, while the applications document in our case is the IDR_MFC_exampleTYPE.

    The String table can be used to display some tooltips or store some constant text that can be accessed from the table anytime. For example, if we want to add a little tooltip that will appear in the status bar, then as soon as we hover the mouse pointer over the Enter Data... menu, we assign the desired text to the menu's ID. For example, check out the entered data below in the attached screenshot.



    You can also use the resource to add bitmaps, and by referring to the bitmap's ID, you can load it in your application and work with it just as with any other. The advantage of this is that you don't have to search for the path of the application because it will be included in the resource and can be accessed with just a couple of clicks.

    One last concept we need to cover is the version tab, which contains information about the current version of the program, the authoring company, copyright details, contact information, and so forth. Basically, if you want to mark the application as yours and enter information about who made it, then this is the place to do it.

    You may have already figured out that every resource has a unique ID assigned to it. We can refer to the resource anywhere in our application by including "Resource.h" in the implementation file (this is where the IDs are defined) and using their IDs as identifiers. Click the button below to download the program that we made; feel free to experiment with it. You should find it especially useful if you were struggling.


    More BrainDump Articles
    More By Gabor Bernat


       · Welcome my friend and thanks for reading my article. As previously mentioned I...
     

    BRAINDUMP ARTICLES

    - Handling Multiple Contracts with Indigo
    - Cleaning Out Your Data in XP
    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway