Using Icons with PasteFace and C++

M

Michael Tissington

I'm trying to set a button face for CommandBar in Outlook, I'm using C++

Here is the code I'm using, but all I get is a blank face.

I'm thinking that I need to actually create a new copy of the clipboard
bitmap but I'm not sure how to do that ... any ideas please?

m_pCmdNewJournal->m_pButton->CopyFace();
OpenClipboard(NULL);
hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP);
CopyIconToBmp(IDI_ACTIVITS, hBitmap);
SetClipboardData(CF_BITMAP, (HBITMAP)bm);
CloseClipboard();
m_pCmdNewJournal->m_pButton->PasteFace();

void COutlookButtons::CopyIconToBmp(WORD wResource, HANDLE hBitmap)
{
HDC hdc;
HDC hdcMem;
HICON hIcon;
HBITMAP hSaved;

hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
hdcMem = CreateCompatibleDC(hdc);

hSaved = (HBITMAP)SelectObject(hdcMem, hBitmap);

hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(wResource));
DrawIconEx(hdcMem, 0, 0, hIcon, 16, 16, 0, 0, DI_NORMAL);
DestroyIcon(hIcon);

SelectObject(hdcMem, hSaved);

DeleteDC(hdcMem);
DeleteDC(hdc);
}
 
R

Roady

I think you have better luck in the microsoft.public.outlook.program_vba
newsgroup

--
Roady
www.sparnaaij.net
Microsoft Office and Microsoft Office related News
Also Outlook FAQ, How To's, Downloads and more...

Question of the month: Color Code Your E-mail!
NEW: Color Code Your E-mail Advanced
www.sparnaaij.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top