Sign in to follow this  
kirkd

Stupid VB question...

Recommended Posts

I have an application which is running fine on the development machine and installs/runs fine on most machines. However, there is one machine on which the application just shuts down after a specific series of actions. I've traced it down to a single line of code which accesses an ImageList object on the VB form. I've seen that there are various problems with MSCOMCTL.ocx on WinXP, but I haven't seen any issues on Win2000. In fact, the machines on which it works are running Win2000 (5.00.2195 SP2) while the machine on which it breaks is running 5.00.2195 SP4). Any tips?? Thanks!!

Share this post


Link to post
Share on other sites
Could you post the line of code (along with the definition of any types you're using) that is crashing? I may be able to check it out.

Share this post


Link to post
Share on other sites
Sure, not that it'll help much, but...



Dim Enteris as Long

Enteris = imgList.ListImages.Count



imgList is an ImageList control on the form that has been preloaded with images. I've tested this and any access to the imgList properties/methods causes the shutdown. I've had this line of code, this control in the exact format in this applicaton for over 2 years with no problem. Now, on this one machine I get the issue.

Thanks for the quick reply!!

-Kirk



Share this post


Link to post
Share on other sites
may want to try changing entries to integer or using CLong() to convert the output of imagelist.count bit, thats all that i can think of, i never had any problems with ms activex controls not working properlly

Share this post


Link to post
Share on other sites
Alright, let's say for example my ImageList control is called "imlMain"

In your code where you want to add the images, type:

iml.ListImages.Add , , LoadPicture("C:\Image.bmp")

or if you wanna load the picture from another picture source, like a picturebox or image:

iml.ListImages.Add , , Picture1.Picture

I'm pretty sure that will work. Try it out.

You can also add an index as well, not sure if it's required though.

EDIT: You'll have to add a key probably, so that the picture can be identified correctly. Just play around with the code until it works.

Syntax:
ListImages.Add Index, Key, Picture

Share this post


Link to post
Share on other sites
Sorry - just tried the following code on a w2k server sp4 machine:

Private Sub Form_Load()
ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")
ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")
ImageList1.ListImages.Add , , LoadPicture("e:\temp\bitmap.bmp")

Dim Enteris As Long
Enteris = ImageList1.ListImages.Count

MsgBox Enteris
End Sub


and it worked fine - which version of the MSCOMCTL.OCX library are you using? (mine is 6.1.95.45)

Share this post


Link to post
Share on other sites
Quote:
Original post by kirkd
Sure, not that it'll help much, but...



Dim Enteris as Long

Enteris = imgList.ListImages.Count



imgList is an ImageList control on the form that has been preloaded with images. I've tested this and any access to the imgList properties/methods causes the shutdown. I've had this line of code, this control in the exact format in this applicaton for over 2 years with no problem. Now, on this one machine I get the issue.

Thanks for the quick reply!!

-Kirk
Doesn't this suggest that the problem is with that PC?! At my work one of the testers found weird access violations that noone had ever seen before when not even doing anything, then my recordset which I never modify supposedly had missing fields, then I found that the FileExists function was lying to me, then I found that the OS failed to warn when files were being overwritten. I discovered that this XP machine has regular problems with the B.S.O.D! Needless to say I flicked the bug reports back where they came from, saying politely that the PC was f*%#&d! Works fine on every other PC.
They're not going to fix this PC until janurary, and the tester is supposed to test my product with that hunk of junk! Sorry for the rant, but you get my point.

btw, write a test program that executes the same failing line of code with minimal other code surrounding it.

Share this post


Link to post
Share on other sites
woh woh woh...

If your program is working on 5 machines but not a 6th say - then it's the 6th machine that has an installation problem.

It's most likely a service pack issue. Do Windows Update, ensure newest version of IE, and reinstall the VB runtime.

If necessary create an install program that includes the exact dlls you are using distributed in the local directory. Dlls search order starts with the current directory... anything in the current directory usually overrides dlls found anywhere else.

Share this post


Link to post
Share on other sites
Hey, hey, hey! Who is this Kryptus character and how did he/she hijack my question? That was quite rude. Moderator?

To answer some questions directed at the person who originally posted the question, aka ME, with answers from ME:

The ImageList control is on a form in my project. The images it contains are loaded at design time through the properties box rather than loading them at run time.

I'm developing with Visual Basic 6 SP6 and have the full Visual Studio 6 SP6 package installed.

The version of MSCOMCTL.ocx is the same on the "broken" machine as it is on the working machines. I don't have access to that machine right now - it is a laptop that someone is now using.

I agree that is must be something about that particular machine or the OS on that machine. I've found many web pages (forums, MSDN) that describe my exact problem but on Windows XP. The machine in question has Win2000 with SP4 and I assume it is up to date. I'm currently installing all possible updates on one of the working machines to see if that breaks the application.

Thank you all for your input!!

-Kirk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this