We help IT Professionals succeed at work.
Get Started

questions on InitCommonControlsEx

isnoend2001 asked
Last Modified: 2012-05-09
I have had an ongoing problem that rarely occurs on some systems.
The error is runtime 0 and my app does not even start. I have narrowed it down to
InitCommonControlsEx. i have been using code from vbaccelerator.
InitCommonControlsVB is the first line in sub Main, so it is called before anything else. See code.
I have not been using the line :On Error GoTo 0 and do not understand the "On Error Resume next"
which i never use in any of my code. My app does include the manifest.
I do not understand the usage of On Error resume next, then the On error Goto 0. Can someone explain ? Do i need to include the Comctl32.dll in my setup? I have noticed that this dll is not even on my system, only a Comctl32.ocx
Public Type tagInitCommonControlsEx
   lngSize As Long
   lngICC As Long
End Type
Public Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean

Public Function InitCommonControlsVB() As Boolean
    On Error Resume Next
   Dim iccex As tagInitCommonControlsEx
   ' Ensure CC available:
   With iccex
       .lngSize = LenB(iccex)
   End With
   InitCommonControlsEx iccex
   InitCommonControlsVB = (err.Number = 0)
   On Error GoTo 0
    End Function

Open in new window

Watch Question
Top Expert 2010
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE