We help IT Professionals succeed at work.
Get Started

questions on InitCommonControlsEx

isnoend2001
isnoend2001 asked
on
469 Views
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.
http://www.vbaccelerator.com/home/vb/code/libraries/xp_visual_styles/using_xp_visual_styles_in_vb/article.asp
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
Const ICC_USEREX_CLASSES = &H200

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

Open in new window

Comment
Watch Question
Top Expert 2010
Commented:
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