A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Changing CommandBarButton image at runtime



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old July 10th 06, 03:35 PM posted to microsoft.public.outlook.program_addins
Tom at GSD
external usenet poster
 
Posts: 84
Default Changing CommandBarButton image at runtime

Hi,

I have developed a ATL C++ addin (Outlook 2002 & 2003) and I have run into
an issue. I need to change the state of a button at runtime and part of this
requirement is switching the button image. I have tried two methods and both
exhibit the same symptom. The symptom is that the image does not change
during normal conditions - however if I set a break poiint within in my
debugger the Image does change. Is seems that this cause the control to
redraw the image - probably because the control is invalidated and updated.
So my question becomes how can I do this programatically? I have tried a few
things to get the button control to redraw, but I believe I must be missing
something. Is there a method that will allow me to force the control to
redraw itself?
Below are the methods I have used ...

1.

OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
CloseClipboard();
spButton-PasteFace();


2.

PICTDESC pdBmp;
pdBmp.cbSizeofstruct = sizeof(PICTDESC);
pdBmp.picType = PICTYPE_BITMAP;
pdBmp.bmp.hbitmap = hBmp;
pdBmp.bmp.hpal = 0;

IPictureDispPtr pPic;
::OleCreatePictureIndirect(&pdBmp, IID_IPictureDisp, TRUE, (LPVOID*) &pPic);
spButton-PutPicture(pPic);

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add an Icon to a commandBarButton David Outlook and VBA 1 March 29th 06 05:39 PM
how to add commandbarbutton to inspector window Ram Outlook and VBA 0 January 19th 06 06:07 AM
how to add commandbarbutton to inspector window Ram Outlook - General Queries 1 January 18th 06 08:42 PM
how to add commandbarbutton to inspector window Ram Add-ins for Outlook 0 January 18th 06 03:18 PM
Outlook Addin CommandBarButton Click Event Not Firing Stu Add-ins for Outlook 0 January 17th 06 02:10 AM


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.