|
-
Nov 9th, 2000, 07:39 PM
#1
Thread Starter
Hyperactive Member
I was doing a picture CD for my grandparents and because they are not exactly any computer wizards, I thought that it would be easy for them to view the picures on the cd if I made an autoplay file that would automatically launch a small image viewing program whenever the CD was inserted. So I made the program, and copied it and the images to the CD, but when I try to run it, it just jams! I mean, the whole system stops responding! I have localized the place where the error occures. Or actually there is no error in terms of a "run time error" or something, it just freezes. I use the LoadPicture method. I tried a few different programs made with visual basic and every single one of them freezes the machine when trying to load a picture from a CD. So could someone tell me what to do? (I'm kind of out of options)
-JR-
-
Nov 10th, 2000, 09:16 AM
#2
Black Cat
Make sure VB Run Time and all other dll's required by your program are already properly installed on their computer.
Also, I noticed some CD-Roms handle CD-R's better than others. My DVD-Rom sometimes freezes up the computer when I stick them in, although luckily it usually unfreezes when I eject the CD-R.
Josh
-
Nov 10th, 2000, 01:01 PM
#3
Thread Starter
Hyperactive Member
But...
But I'm trying to run the program (that is already copied to the CD) on my own computer. And that's like really weird. The prgram runs perfectly, but when it comes to the loadpicture statement, it freezes. So my current theory would be that... hmm... well, the statement that messes up the whole thing is the loadpicture.
-JR-
-
Nov 10th, 2000, 01:33 PM
#4
Fanatic Member
If you are running the program from the CD and the image files are on the CD too, just use app.path to get the full directory path location.
Chemically Formulated As:
Dr. Nitro
-
Nov 10th, 2000, 02:06 PM
#5
Thread Starter
Hyperactive Member
Hmmm...
I don't think its that simple (I am actually using app.path to get the dir). The problem is the loadpicture statement. It just doesn't work with images located on CD's. Does anybody know any other (preferrably convenient) way of loading images from disk?
-JR-
-
Nov 10th, 2000, 02:20 PM
#6
Fanatic Member
Are you sure that the pathname is correct? Maybe App.Path returns 'c:\' if the program is in the root, instead of 'c:'. And your program adds \,so that can be the problem.
-
Nov 10th, 2000, 02:42 PM
#7
Fanatic Member
Why don't you post that section of your code and maybe we can help.
Chemically Formulated As:
Dr. Nitro
-
Nov 10th, 2000, 10:34 PM
#8
Thread Starter
Hyperactive Member
Das Code...
The piece of code follows:
Private Sub Command1_Click()
On Error Resume Next
Frame1.Visible = 0
File1.SetFocus
File1.ListIndex = 0
End Sub
So this is not actually the code that I think jams the system, but it gives the click event to file1. Frame1 is a welcome message in the center of the form (that is maximized by default), that is set invisible by clicking command1. File1 has (in click event) the following code:
On Error Resume Next
Image1.Picture = LoadPicture(File1.Path + "\" + File1.List(File1.ListIndex))
Label21.Caption = "This is image number" + Str(File1.ListIndex + 1) + " of all pictures totaling" + Str(File1.ListCount)
I'm not a wiz of any sort, so pardon me if I maybe explain some things not-so-clearly...
-JR-
-
Nov 11th, 2000, 02:19 AM
#9
Fanatic Member
OK first of all, try to use less of On Error Resume Next. Use that only if you really have to because you won't know where your error lies if one does exist.
Second, don't use "+" to concatenate something. In VB, you use "+" for arithmetic not concatenation. Use "&" for concatenation.
If I am not wrong, I bet you also have a Drive control and Dir control on your form. If so, did you have something similar to this?
Code:
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
As for your code on the LoadPicture line, I don't really see anything wrong except for the "+".
To test if your CD works or not, why not try this.
If your CD is on Drive D: for instance, try
Image1.Picture = LoadPicture("D:\An Existing Jpeg.jpg")
If that works, nothing is wrong with accessing your CD, it is something else in your code.
Chemically Formulated As:
Dr. Nitro
-
Nov 11th, 2000, 04:24 AM
#10
Frenzied Member
If it is just for ur grandparents then u must know their system details so just build the app around their pc, put the app on the desktop for them so its easy to find. Then just make it open like E:\Banana.bmp rather than app.path & "\Banana.bmp". I say build an app specific to their pc and their needs
-
Nov 13th, 2000, 06:23 PM
#11
Thread Starter
Hyperactive Member
I love you people!
Yep, thanks for all those ideas (I have no idea what concatenate means ), I'm going to try em out.
The idea to plant the app to their desktop by me would be OK if they didn't live on the other side of the globe, so I kinda have to build it totally on the CD. I am about 100% sure that the error occures because the LoadPicture statement doesn't somehow work with CD's, since I have a few other programs that allow me to browse and select an image file from whatever location (with a drive box, a dir list and a filelist), and it works completely with any image from my hard drives, but when I try to open one from a CD, the machine freezes.
Just crossed my mind that I could make a prog that would copy the selected file from the CD to a temp folder in the hard drive and then load it from there and remove it afterwards, but I'd prefer to find another solution...
But thanks again, I'll play around with the prog and probably tell you if I get it working.
-JR-
-
Nov 13th, 2000, 10:46 PM
#12
Hyperactive Member
y not use the open dialog box?
n set its main directory to look in as the cd-rom drive letter your grandparents have?
that way you wouldn't have to worry about where the pics r stored with drive list boxes and stuff
-
Nov 14th, 2000, 10:40 PM
#13
Thread Starter
Hyperactive Member
Actually (as I said) it's not the locating of the pictures, it's the loading process (loadpicture statement).
I have a filelistbox and it lists all the files neatly, but when I try to load them, freezes.
-JR-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|