Link to home
Start Free TrialLog in
Avatar of Dale Fye
Dale FyeFlag for United States of America

asked on

Extracting commandbar FaceIDs for use as image in an image control

I've figured out how to extract both the PICTURE and MASK properties of the FaceId of any of the Office commandbar controls, and save those two properties as images on my computer.

        Set ctrl = CommandBars.FindControl(Id:=rs!FaceId)
        stdole.SavePicture ctrl.Picture, "E:\TempPic.bmp"
        stdole.SavePicture ctrl.Mask, "E:\TempMask.bmp"

But what I want to do is create an image picker that displays a set of these images in a form, either in an image control or as the picture property of a command button.  Unfortunately, neither the image control or the command button has a Mask property, so the background of all of the picture images are black, rather than what they are supposed to be.  
User generated imageThe image (above) shows the first 15 faceIDs, with the top row displaying the image saved with the PICTURE property and the bottom row showing the image created with the MASK property.

Is there a way to combine these images or to save the image as a gif or other image type, which can then be assigned to the PICTURE property of an image control or a command button?
SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dale Fye

ASKER

Thanks, Alexey, I'll take a look, but I was hoping that I wouldn't have to resort to a 3rd party application.  Would prefer to not have to actually distribute the over 3000 face images available in the various Office applications.  

I was hoping there was a way to capture the image intact and that I could go straight from the commandbarcontrol to the clipboard or file and then to the picture property of either an image or command button on a form.

I've seen a couple of things that take advantage of a ribbon gallery, and want to do something similar to that, without using the ribbon.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, for your help, but it turns out that that method is a lot of work.  

But I fortunately found an alternative, starting in 2007 the commandbar object has several GetImageXXX methods.  The particular version that I'm using is the GetImageMSO method which looks like:

Dim pic as iPictureDisp
set pic = Application.CommandBars.GetImageMso(msoID, 16, 16)
stdole.SavePicture pic, "E:\Temp.BMP"

This method allows me to save the image intact, but you must know the msoID values associated with the method.  I was finally able to find a list of the msoID text values (which are similar to, but not the same as the Captions of the commandbar controls that you get when you loop through the various commandbar control ID values).  And am now able to quickly (under 1 second) generate a form which displays a set of 255 images, and loop through the data to view and select from among these images.  .

3,286 of these images are available in Access 2007, but 2010 and 2013 apparently have over 8500, have not tested it in those environments yet.  Some of the images are duplicates, but have different msoID values, for example, the green check-marks in row 4 have msoID values of "AcceptInvitation", "AcceptProposal", and "AcceptTask"
Joe, i'll try to get this new interface into the tool this weekend and get you a copy to play with by next week.