Add OLE Toolbar Resources

The server application also provides an in-place toolbar to the container. This toolbar typically supports a different set of commands than does the container’s usual toolbar, generally a subset. For example, the in-place toolbar does not support File menu commands, because the container, not the server, must handle those commands even if the server is activated in place.

Suggested Reading in the Visual C++ User’s Guide

AppWizard provides a default in-place toolbar resource with five buttons. The COleIPFrameWnd-derived class is responsible for specifying the mapping of commands to toolbar buttons.

To view the default in-place toolbar

  1. Open the scratch version of Scribble.rc, expand the Toolbar folder and double-click IDR_SCRIBBTYPE_SRVR_IP.

    The Toolbar editor opens.

  2. Click Properties from the View menu to view the Toolbar Button Properties page, which displays the default resource IDs and prompt strings.

  3. Close the Toolbar editor for the next procedure.

The Toolbar editor makes it easy to edit your application toolbar resources. In the following procedure, you’ll copy the AppWizard-generated toolbar resources for in-place activation of Scribble into your Scribble project. Then you’ll edit the toolbars to match your other Scribble project toolbar resources.

To copy the toolbar buttons

  1. With the scratch Scribble.rc file open and the Toolbar folder expanded, switch to ResourceView in your Scribble project and expand the Toolbar folder.

  2. Hold down the CTRL key while you drag the toolbar resource, IDR_SCRIBBTYPE_SRVR_IP, from the AppWizard-provided scratch resource file into your Scribble project Toolbar folder.

    Close the scratch Scribble.rc file.

  3. In ResourceView, double-click both Scribble toolbar resources — IDR_MAINFRAME and IDR_SCRIBBTYPE_SRVR_IP and arrange them in the editor window so they don’t overlap.

  4. Hold down the CTRL key while you drag the Pen Width button from the IDR_MAINFRAME toolbar to the IDR_SCRIBBTYPE_SRVR_IP toolbar, just after the Paste button.

  5. Delete the Cut, Copy and Paste buttons from the IDR_SCRIBBTYPE_SRVR_IP toolbar by dragging them off the toolbar.

    Your in-place toolbar should now contain just three buttons: the application Help button, the Pen Widths button, and the Help Mode button. This is the toolbar that will appear when Scribble is activated as an OLE server application.

  6. Save your Scribble project .RC file and close the toolbar editors.