Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing external WMF references with embedded resource 1

Status
Not open for further replies.

spamjim

Instructor
Mar 17, 2008
1,368
US
I am trying to sort out an inherited program that needs to exist a few more years. The intent is to make the executable contain everything it needs, instead of calling on external image files. Currently, I have:

Code:
Image1.Picture = LoadPicture("C:\Demo\image.wmf")

I understand that I can add the following resources to the VB Resource Editor:
cursor (.CUR), icon (.ICO), bitmap (.BMP), custom (.*)

...and that if the WMF is to go anywhere, it needs to be filed under "custom". So I added he WMF to the VB Resource Editor.

Can anyone point me toward how to call the WMF file from the resources? This does not work...
Code:
Image1.Picture = LoadResData(101, "CUSTOM")
 
VB's LoadPicture doesn't understand the resource file - but Windows Image Acquisition (WIA) does, so you just need an alternative loadpicture function such as:

Code:
[blue]Private Function wiaLoadPicture(ByVal Index As Integer) As StdPicture
    With CreateObject("WIA.Vector")
        .BinaryData = LoadResData(Index, "CUSTOM")
        Set wiaLoadPicture = .Picture
    End With
End Function[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top