Computing.Net > Forums > Programming > Images in VB6

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Images in VB6

Reply to Message Icon

Original Message
Name: geekindustries
Date: November 10, 2004 at 19:05:48 Pacific
Subject: Images in VB6
OS: XP Pro
CPU/Ram: Athlon XP 2800+/1GB DDR33
Comment:

Okay, so this is probably and basic newbie question but I can't find the answer VIA google or my SAM's in 21 days book. But, I have a program that loads images using the LoadPicture function. Problem comes with distrubting the exe. You have to have the pictures in that exact path for it to work. Is there some way to include them in the exe so it's on stand alone thing? I would really appreciate the help! *bands head on desk*


Report Offensive Message For Removal


Response Number 1
Name: Sci-Guy
Date: November 11, 2004 at 06:24:38 Pacific
Reply: (edit)

As far as embedding the pics into the exe, I don't think you can. When you say "You have to have the pictures in that exact path for it to work", are you using something like this?
-------------
Image1.Picture = LoadPicture(C:\Program Files\MyApp\Pic.bmp)
-------------
If so, try instead:
-------------
Image1.Picture = LoadPicture(App.Path & "Pic.bmp")
-------------
Hope this helps.



Report Offensive Follow Up For Removal

Response Number 2
Name: Sci-Guy
Date: November 11, 2004 at 06:34:03 Pacific
Reply: (edit)

I should also mention that sometimes the path ends in a backslash, sometimes it doesn't. For this reason it's better to use For...Else like so:
---------------------------
If Right$(App.Path ,1 ) = "\" Then
Image1.Picture = LoadPicture(App.Path & "Pic.bmp")
Else
Image1.Picture = LoadPicture(App.Path & "\Pic.bmp")
End If

---------------------------


Report Offensive Follow Up For Removal

Response Number 3
Name: geekindustries
Date: November 11, 2004 at 08:17:50 Pacific
Reply: (edit)

Yes, that's what I was doing. Thanks for the help.

But I have seen an exe that had images in it. They could have been microsoft clip art that I already had on my machine, but somehow I doubt it. I could email someone the exe if someone wants to see it. *shrugs*


Report Offensive Follow Up For Removal

Response Number 4
Name: Sci-Guy
Date: November 11, 2004 at 16:40:14 Pacific
Reply: (edit)

I don't know where my head was when I replied previously, but you can do what you want. Don't use LoadPicture. Use the Picture property from the Properties Window. You'll be able to distribute the exe without including the pictures.



Please let us know if you found someone's advice to be helpful.



Report Offensive Follow Up For Removal

Response Number 5
Name: Chi Happens
Date: November 12, 2004 at 02:32:03 Pacific
Reply: (edit)

if you have a lot of pics you can use an imagelist also.

Chi

"They mostly come at night...mostly"


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge
Poll History




Data Recovery Software