home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / ucComboTra1945531132005.psc / mCCEx.bas < prev    next >
BASIC Source File  |  2005-10-17  |  1KB  |  50 lines

  1. Attribute VB_Name = "mCCEx"
  2. Option Explicit
  3.  
  4. Private Type uInitCommonControlsEx
  5.    lSize As Long
  6.    lICC  As Long
  7. End Type
  8.  
  9. Private Const ICC_USEREX_CLASSES As Long = &H200
  10.  
  11. Private Declare Function InitCommonControlsEx Lib "comctl32" (iccex As uInitCommonControlsEx) As Boolean
  12.  
  13. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  14. Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
  15.  
  16.  
  17.  
  18. Private m_hMod As Long
  19.  
  20. Private Function InitCommonControlsVB() As Boolean
  21.  
  22.   Dim uICCEx As uInitCommonControlsEx
  23.    
  24.     On Error Resume Next
  25.     
  26.     With uICCEx
  27.         .lSize = LenB(uICCEx)
  28.         .lICC = ICC_USEREX_CLASSES
  29.     End With
  30.     Call InitCommonControlsEx(uICCEx)
  31.     InitCommonControlsVB = (Err.Number = 0)
  32.     
  33.     On Error GoTo 0
  34. End Function
  35.  
  36. Public Sub Main()
  37.    
  38.    m_hMod = LoadLibrary("shell32.dll") ' Prevents crashes on Windows XP
  39.    Call InitCommonControlsVB
  40.    Call fTest.Show
  41. End Sub
  42.  
  43. Public Sub SafeEnd()
  44.  
  45.     Call FreeLibrary(m_hMod)
  46. End Sub
  47.  
  48.  
  49.  
  50.