![]() |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
hello world,
there has been a similar question back in 2004 - with no solution, yet: http://groups.google.com/group/micro...3995045b77b4b/ i'm working on an ECE (exchange client extension) for outlook which adds a couple of 16x16 buttons to the outlook toolbar. i'm using VC++ and MAPI. these buttons have a 16 colour bitmap displayed. the purple color RGB(255,0,255) in the bitmaps is the transparent color when outlook runs. i want to change the button bitmaps to be 256 color (8bpp). when i do this i cannot get transparency to work like it does with the 16 color bitmaps. the purple shows up. is there any way i can get a color to be transparent? below is the code used to add the button to the toolbar. i am using outlook XP, but have the same thing happen with outlook 2003. TBADDBITMAP tbab; tbab.hInst = AfxGetInstanceHandle(); tbab.nID = uiBitmapID; *puiToolBarM = SendMessage(hwndToolbar, TB_ADDBITMAP, 1, (LPARAM)&tbab); 1) one solution might be to make use of the OOM (outlook object model) to place and paint toolbar buttons. but i'd rather prefer not to add OOM code to my ECE. 2) i found some advice to use TB_SETIMAGELIST instead of TB_ADDBITMAP. but i couldn't get it work from within the ECE's InstallCommands via SendMessage. any help greatly appreciated. kind regards, gustafson some more keywords: ImageList_AddMasked TB_ADDBITMAP TB_ADDBUTTONS TB_SETIMAGELIST toolbar loadbitmap loadimage ImageList_Create ImageList_Add IExchExt LR_CREATEDIBSECTION COLORREF IExchExtCommands LPEXCHEXTCALLBACK EETBID_STANDARD button icon *.bmp resource png |
outlook toolbar: 256 color bitmaps via exchange client extension (
Hi gustafson,
I created the following function below that seems to work really well for creating a mask. Then call the following few of lines of code using the mask function. PICTDESC pdBmpMask; pdBmpMask.cbSizeofstruct = sizeof(PICTDESC); pdBmpMask.picType = PICTYPE_BITMAP; pdBmpMask.bmp.hpal = 0; pdBmp.bmp.hbitmap = ::LoadBitmap( _AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDB_IMAGE)); // Create the mask using white pdBmpMask.bmp.hbitmap = CreateBitmapMask(pdBmp.bmp.hbitmap, RGB(255,255,255)); IPictureDispPtr pPicMask; ::OleCreatePictureIndirect(&pdBmpMask, IID_IPictureDisp, TRUE, (LPVOID*) &pPicMask); spButton-PutMask(pPicMask); HBITMAP CNewMessage::CreateBitmapMask(HBITMAP hbmColorImage, COLORREF crTransparent) { HDC hdcMem, hdcMem2; HBITMAP hbmMask; BITMAP bm; // Create monochrome (1 bit) mask bitmap. GetObject(hbmColorImage, sizeof(BITMAP), &bm); hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL); // Get some HDCs that are compatible with the display driver hdcMem = CreateCompatibleDC(0); hdcMem2 = CreateCompatibleDC(0); ::SelectObject(hdcMem, hbmColorImage); ::SelectObject(hdcMem2, hbmMask); // Set the background color of the color image to the color // you want to be transparent. SetBkColor(hdcMem, crTransparent); BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY); BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem2, 0, 0, SRCINVERT); // Clean up. DeleteDC(hdcMem); DeleteDC(hdcMem2); return hbmMask; } Tom - " wrote: hello world, there has been a similar question back in 2004 - with no solution, yet: http://groups.google.com/group/micro...3995045b77b4b/ i'm working on an ECE (exchange client extension) for outlook which adds a couple of 16x16 buttons to the outlook toolbar. i'm using VC++ and MAPI. these buttons have a 16 colour bitmap displayed. the purple color RGB(255,0,255) in the bitmaps is the transparent color when outlook runs. i want to change the button bitmaps to be 256 color (8bpp). when i do this i cannot get transparency to work like it does with the 16 color bitmaps. the purple shows up. is there any way i can get a color to be transparent? below is the code used to add the button to the toolbar. i am using outlook XP, but have the same thing happen with outlook 2003. TBADDBITMAP tbab; tbab.hInst = AfxGetInstanceHandle(); tbab.nID = uiBitmapID; *puiToolBarM = SendMessage(hwndToolbar, TB_ADDBITMAP, 1, (LPARAM)&tbab); 1) one solution might be to make use of the OOM (outlook object model) to place and paint toolbar buttons. but i'd rather prefer not to add OOM code to my ECE. 2) i found some advice to use TB_SETIMAGELIST instead of TB_ADDBITMAP. but i couldn't get it work from within the ECE's InstallCommands via SendMessage. any help greatly appreciated. kind regards, gustafson some more keywords: ImageList_AddMasked TB_ADDBITMAP TB_ADDBUTTONS TB_SETIMAGELIST toolbar loadbitmap loadimage ImageList_Create ImageList_Add IExchExt LR_CREATEDIBSECTION COLORREF IExchExtCommands LPEXCHEXTCALLBACK EETBID_STANDARD button icon *.bmp resource png |
outlook toolbar: 256 color bitmaps via exchange client extension
hi tom,
thank you very much for your answer. unfortunately your code uses the OOM. and as i wrote in my initial posting: i'd rather not add OOM code to my ECE. so, still hoping for a solution ... kind regards, gustafson I created the following function below that seems to work really well for creating a mask. Then call the following few of lines of code using the mask function. [...] ::OleCreatePictureIndirect(&pdBmpMask, IID_IPictureDisp, TRUE, (LPVOID*) &pPicMask); spButton-PutMask(pPicMask); |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
I don't think you will have much luck - everybody I know gave up on using
ECE to modify the icons. Why don't you want to use OOM for that? You can still add buttons using the ECE API, but you should be able to modify the icons using OOM from your ECE. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool wrote in message ups.com... hello world, there has been a similar question back in 2004 - with no solution, yet: http://groups.google.com/group/micro...3995045b77b4b/ i'm working on an ECE (exchange client extension) for outlook which adds a couple of 16x16 buttons to the outlook toolbar. i'm using VC++ and MAPI. these buttons have a 16 colour bitmap displayed. the purple color RGB(255,0,255) in the bitmaps is the transparent color when outlook runs. i want to change the button bitmaps to be 256 color (8bpp). when i do this i cannot get transparency to work like it does with the 16 color bitmaps. the purple shows up. is there any way i can get a color to be transparent? below is the code used to add the button to the toolbar. i am using outlook XP, but have the same thing happen with outlook 2003. TBADDBITMAP tbab; tbab.hInst = AfxGetInstanceHandle(); tbab.nID = uiBitmapID; *puiToolBarM = SendMessage(hwndToolbar, TB_ADDBITMAP, 1, (LPARAM)&tbab); 1) one solution might be to make use of the OOM (outlook object model) to place and paint toolbar buttons. but i'd rather prefer not to add OOM code to my ECE. 2) i found some advice to use TB_SETIMAGELIST instead of TB_ADDBITMAP. but i couldn't get it work from within the ECE's InstallCommands via SendMessage. any help greatly appreciated. kind regards, gustafson some more keywords: ImageList_AddMasked TB_ADDBITMAP TB_ADDBUTTONS TB_SETIMAGELIST toolbar loadbitmap loadimage ImageList_Create ImageList_Add IExchExt LR_CREATEDIBSECTION COLORREF IExchExtCommands LPEXCHEXTCALLBACK EETBID_STANDARD button icon *.bmp resource png |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
I don't think you will have much luck - everybody I know gave up on using
ECE to modify the icons. Why don't you want to use OOM for that? You can still add buttons using the ECE API, but you should be able to modify the icons using OOM from your ECE. Out of interest, how would you go about modifying icons using the OOM, that were added using the ECE API? Many thanks, Chris |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
You can access any button (even if it was added by an ECE) using
Explorer/Inspector.CommandBars collection. It does not matter what created the buttons. But why not use OOM to begin with? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool wrote in message ups.com... I don't think you will have much luck - everybody I know gave up on using ECE to modify the icons. Why don't you want to use OOM for that? You can still add buttons using the ECE API, but you should be able to modify the icons using OOM from your ECE. Out of interest, how would you go about modifying icons using the OOM, that were added using the ECE API? Many thanks, Chris |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
Does this help?
HRESULT SetImageOnButton(Office::_CommandBarButtonPtr pButton, int iBitmapResID) { pButton-PutStyle(Office::msoButtonIconAndCaption); HBITMAP hBmp =(HBITMAP)::LoadImage( AfxGetApp()-m_hInstance, MAKEINTRESOURCE(iBitmapResID), IMAGE_BITMAP, 0, 0, LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS | LR_SHARED); PICTDESC PictDesc; PictDesc.picType = PICTYPE_BITMAP; PictDesc.bmp.hbitmap = hBmp; PictDesc.bmp.hpal = NULL; PictDesc.cbSizeofstruct = sizeof(PictDesc); CComPtrIPictureDisp pDisp; HRESULT hRes = OleCreatePictureIndirect(&PictDesc, __uuidof(pDisp), TRUE, (void**)&pDisp) ; if(SUCCEEDED(hRes)) { VARIANT p1; p1.vt = VT_DISPATCH; p1.pdispVal = pDisp; hRes = PutProperty(pButton, L"Picture", &p1); } return hRes; } //This is some MSDN Code STDMETHODIMP PutProperty(LPDISPATCH pDisp, LPOLESTR pszName, VARIANT* pvValue) { if (NULL == pDisp) return E_POINTER; if (NULL == pvValue) return E_POINTER; DISPID dwDispID; DISPID dispidPut = DISPID_PROPERTYPUT; DISPPARAMS dispparams = {NULL, NULL, 1, 1}; dispparams.rgvarg = pvValue; dispparams.rgdispidNamedArgs = &dispidPut; HRESULT hr = pDisp-GetIDsOfNames(IID_NULL, &pszName, 1, LOCALE_USER_DEFAULT, &dwDispID); if(SUCCEEDED(hr)) { if (pvValue-vt == VT_UNKNOWN || pvValue-vt == VT_DISPATCH || (pvValue-vt & VT_ARRAY) || (pvValue-vt & VT_BYREF)) { hr = pDisp-Invoke(dwDispID, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD | DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); if (SUCCEEDED(hr)) return hr; } hr = pDisp-Invoke(dwDispID, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD | DISPATCH_PROPERTYPUTREF, &dispparams, NULL, NULL, NULL); } return hr; } Nishant Mehta Dmitry Streblechenko wrote: You can access any button (even if it was added by an ECE) using Explorer/Inspector.CommandBars collection. It does not matter what created the buttons. But why not use OOM to begin with? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool wrote in message ups.com... I don't think you will have much luck - everybody I know gave up on using ECE to modify the icons. Why don't you want to use OOM for that? You can still add buttons using the ECE API, but you should be able to modify the icons using OOM from your ECE. Out of interest, how would you go about modifying icons using the OOM, that were added using the ECE API? Many thanks, Chris |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
Sorry I forgot to mention, I am very new to Development for outlook and
use a lot of help available on the groups so am sure most of my code takes "inspiration" from someone else's posts. Hope my post helps anyway. Nishant |
outlook toolbar: 256 color bitmaps via exchange client extension (ECE)?
Sorry again ! First bit of the bitmap is considered as the transparent color. Nishant |
All times are GMT +1. The time now is 06:47 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com