P
Phlip
Newsgroupies:
The sample code on this page is user-hostile:
http://www.mindcracker.com/mindcracker/c_cafe/atl/BuildingOffice2KCOMAddInAD.asp
// to set a bitmap to a button, load a 32x32 bitmap
// and copy it to clipboard. Call CommandBarButton's PasteFace()
// to copy the bitmap to the button face. to use
// Outlook's set of predefined bitmap, set button's FaceId to //the
// button whose bitmap you want to use
HBITMAP hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),
MAKEINTRESOURCE(IDB_BITMAP1),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
// put bitmap into Clipboard
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
:eleteObject(hBmp);
// set style before setting bitmap
spCmdButton->PutStyle(Office::msoButtonIconAndCaption);
If the user copies text, launches Word, and pastes, they will insert my
beautiful bitmap, not their text.
However, if I use FaceId, I get one of the built-in icons.
How do I get my own icon without destroying the clipboard contents?
Can one push the clipboard contents onto a stack and then pop it?
And why do CommandBars support a technique that's user hostile?
The sample code on this page is user-hostile:
http://www.mindcracker.com/mindcracker/c_cafe/atl/BuildingOffice2KCOMAddInAD.asp
// to set a bitmap to a button, load a 32x32 bitmap
// and copy it to clipboard. Call CommandBarButton's PasteFace()
// to copy the bitmap to the button face. to use
// Outlook's set of predefined bitmap, set button's FaceId to //the
// button whose bitmap you want to use
HBITMAP hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),
MAKEINTRESOURCE(IDB_BITMAP1),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
// put bitmap into Clipboard
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
:eleteObject(hBmp);
// set style before setting bitmap
spCmdButton->PutStyle(Office::msoButtonIconAndCaption);
If the user copies text, launches Word, and pastes, they will insert my
beautiful bitmap, not their text.
However, if I use FaceId, I get one of the built-in icons.
How do I get my own icon without destroying the clipboard contents?
Can one push the clipboard contents onto a stack and then pop it?
And why do CommandBars support a technique that's user hostile?