Solved

Extracting commandbar FaceIDs for use as image in an image control

Posted on 2014-11-09
6
264 Views
Last Modified: 2014-11-14
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.  
several sample images with Picture and MaskThe 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?
0
Comment
Question by:Dale Fye (Access MVP)
6 Comments
 
LVL 39

Assisted Solution

by:als315
als315 earned 250 total points
ID: 40431564
I can't give you exact command, but you can combine image and mask with ImageMagick:
http://www.imagemagick.org/
0
 
LVL 47

Author Comment

by:Dale Fye (Access MVP)
ID: 40431609
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.
0
 
LVL 24

Accepted Solution

by:
chaau earned 250 total points
ID: 40431654
I think MaskBlt is what you are after. However, to use it you need the HBITMAP handles. To Load a HBITMAP from file use the following API:
HBITMAP hBMP = (HBITMAP) LoadImage( NULL, "e:\\TempPic.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

Open in new window

HBITMAP hMask = (HBITMAP) LoadImage( NULL, "e:\\TempMask.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

Open in new window

Please let me know if you need the whole C++ function
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 47

Author Closing Comment

by:Dale Fye (Access MVP)
ID: 40443016
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"
0
 
LVL 75
ID: 40443189
COOL !
0
 
LVL 47

Author Comment

by:Dale Fye (Access MVP)
ID: 40443259
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.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now