|
-
Nov 10th, 2000, 03:57 AM
#1
Thread Starter
Lively Member
My program loads picture files into an image control from a specific directory every 2 seconds. Once it reach the end, it cycle to the beginning and reload the first pictures in again. After several cycles, it just crash and load a white image into the image control. Anyone experience with this before?
-
Nov 10th, 2000, 04:46 AM
#2
PowerPoster
You must clear the image control picture before you loading a new image into it. if you did not do that, it take all you memory and cause your program having insufficient memory error.
Code:
Image1.Picture = LoadPicture()
Image1.Picture = LoadPicture(<Your Image file>)
-
Nov 10th, 2000, 08:06 AM
#3
transcendental analytic
BTW, you should load all images, if you don't have a too large amount of them, into stdpictures and then you just switch the pictures every 2 seconds.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 10th, 2000, 02:26 PM
#4
Thread Starter
Lively Member
Thanks you Chris and Ked.
Ked I like to know what you mean by "into stdpictures"
I am making a screen saver loading against a particular directory. What you said make sense Chris. I thought of that but wasn't sure if that was the problem. Now you confirmed. Thanks.
-
Nov 10th, 2000, 04:14 PM
#5
StdPicture is a data type. (a picture). You can treat it the same way you would treat the "Picture" property of a PictureBox.
Code:
Dim MyPic As StdPicture
MyPic = LoadPicture("MyFileName.bmp")
Then you can load it into the Picturebox by using:
-
Nov 10th, 2000, 07:38 PM
#6
Thread Starter
Lively Member
Thank you for your explantion Meg. Have a good weekend all.
-
Nov 10th, 2000, 07:49 PM
#7
Thread Starter
Lively Member
Which one should I use for my screen saver?
Code:
Dim Temp As New StdPicture
'Set Temp = LoadPicture()
Set Temp = LoadPicture(File)
Set Image1.Picture = Temp
Code:
Dim Temp As New StdPicture
Set Temp = LoadPicture()
Set Temp = LoadPicture(File)
Set Image1.Picture = Temp
-
Nov 10th, 2000, 09:05 PM
#8
Fanatic Member
I am not sure about this but here is an idea.
You can also set = nothing.
SET Image1.Picture = Nothing
SET Image1.Picture = LoadPicture(Your File)
Chemically Formulated As:
Dr. Nitro
-
Nov 11th, 2000, 02:38 PM
#9
transcendental analytic
Well actually it's not nessesary, the vb unloads the stdpicture automatically if you switch to another, otherways vb would be a bit crappy language.
Btw, 0 0 7, i thought you had an animation of pictures ?
You could have use of an array of stdpictures, of which you just switch to the image control, for instance in a timer:
Code:
private buffer() as stdpicture
private counter as integer, count as integer
Private Sub Form_Load()
Dim x as long
count=10
for x = 0 to 9
Set buffer(X) = LoadPicture(File & x & ".bmp")
next x
End Sub
Private Sub Timer1_Timer()
counter=(counter + 1)mod count
set image1.picture = buffer(counter)
End Sub
And theres one more thing, don't use new keyword in a declaration statement
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 11th, 2000, 04:28 PM
#10
Thread Starter
Lively Member
Thanks Kedaman,
If I store all 200 Jpegs in a directory into the array buffer(X), wouldn't that take up alot of memory?
-
Nov 11th, 2000, 05:18 PM
#11
transcendental analytic
Whoops, that would be almost too much, unless they are small like 50*50 or something. If not you could skip the buffer thing, and just load the pictures with Loadpicture directly into the image.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 11th, 2000, 05:29 PM
#12
Thread Starter
Lively Member
If I do that, I am back to square 1. I would get a freeze screen after the 400th picture. I am going to try either Chris or Nitro code. Setting it back to nothing before I load a new file into the image control. I think Chris is right, it was hogging up memory or resources.
Thanks for your help Kedaman!
-
Nov 11th, 2000, 06:05 PM
#13
transcendental analytic
I'm out of ideas, well try Nitros and Chris stuff, but i'm sure the problem lays somewhere else
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 11th, 2000, 06:08 PM
#14
Thread Starter
Lively Member
Thank you for your time. You did all you can. Wish I can pay you in some way. Bye.
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
|