Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ImageList from VB6 application causes crash on Windows 7.0 64-bit

I have an old VB6 application that uses an ImageList control from COMCTL32.OCX ("Microsoft Windows Common Controls 5.0 (SP2)") to provide icons for TreeViews and ListViews.

The app won't even launch on Windows 7.0 64 bit. The minute it tries to load the form that has the ImageList on it, it crashes (well, actually, the app winks out, exiting without a trace).

Removing the ImageList from the form solves the problem.

Any ideas?

like image 952
Joel Spolsky Avatar asked Jun 19 '09 16:06

Joel Spolsky


3 Answers

I resolved this problem by replacing all instances of COMCTL32.OCX, which came with VB5, with MSCOMCTL.OCX, which came with VB6.

Microsoft KB article 190952 has instructions for doing this. It was pretty much just a global-search-and-replace operation.

like image 191
Joel Spolsky Avatar answered Oct 22 '22 14:10

Joel Spolsky


Report a bug to Microsoft. The VB6 runtime is still supported on 64-bit Windows 7. COMCTL32.ocx isn't installed with Windows 7, but it is explicitly listed as supported on Windows 7.

like image 2
MarkJ Avatar answered Oct 22 '22 14:10

MarkJ


Your solution is OK. But COMCTL32.OCX should work fine on Win64 anyway (Vista or 7).

Just a little advice:

If using MSCOMCTL.OCX you won't be able to apply to your listview or treeview the XP/Vista/7 style and your app might look alien. Manifest won't have any effect on MSCOMCTL.OCX controls.

A workaround would be to subclass the MSCOMCTL.OCX controls, and since they still contain a COMCTL32.DLL header you could manipulate how it paints.

(I would've posted as a comment, but I still can't)

like image 2
user97863 Avatar answered Oct 22 '22 14:10

user97863