Make toolbar without using MFC IDE

If you wants to makes toolbar with out using MFC IDE. MFC IDE is too much ugly and helpless to make toolbar using high resolution bitmap. For this Purpose you needs following line to write in .rc file

IDR_RCTOOLBAR           BITMAP                  “res\\LargeIcons.bmp”

IDR_RCTOOLBAR TOOLBAR  32, 32
BEGIN
  BUTTON     ID_NEW
  BUTTON     ID_OPEN
  BUTTON     ID_SAVE
  BUTTON     ID_PAST
  BUTTON     ID_SEARCH
  BUTTON     ID_PRINT
  SEPARATOR
  BUTTON     ID_UNKNOWN01
  BUTTON     ID_FILE
  BUTTON     ID_FILESEARCH
  BUTTON     ID_DISPLAY
  SEPARATOR
  BUTTON     ID_UNKNOWN02
  BUTTON     ID_UNKNOWN03
  BUTTON     ID_UNKNOWN04
END

In this line you are telling about resource name and mapped bitmap.
IDR_RCTOOLBAR           BITMAP                  “res\\LargeIcons.bmp”

In this line you are telling about resource type which is toolbar and size of images which it will be contains.
IDR_RCTOOLBAR TOOLBAR  32, 32

“BEGIN” and “END” indicated the body of toolbar resources.

In the toolbar body you are specifying the type of resource contain in toolbar, and in this line I am telling type is button and reference id.
  BUTTON     ID_NEW

“SEPARATOR” indicates the separating bar which will be separates toolbar items.

After writing code in .rc file you should have to define resource Id’s in resource.h file. This step needs to care to define resource ids. Commonly toolbar resource [IDR_RCTOOLBAR] use the range of 131 or _APS_NEXT_RESOURCE_VALUE, and command IDs (buttons, menu commands, …) start with values of 32768.  Most of the time visual studio generates following line in resources.h file which helps you in defining resource IDs.

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        131
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1008
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

You must Includes toolbar image file in your project solution.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s