title: Loading OCX dynamically in VB 6.0
body: <p>I am loading OCX dynamically in VB 6.0.</p>
  
  <p>The following is the code that I am using to load and call the methods:</p>
  
  <pre><code>Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long 
  Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long 
  Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long 
  Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long 
  
  Private Sub Foo 
    On Error Resume Next 
  
    Dim lb As Long, pa As Long 
    Dim versionString As String 
    Dim retValue as Long 
  
    lb = LoadLibrary("D:\projects\other\VB_DLLs\TestDLL\TestDLL.dll")   
  
    'retrieve the address of getVersion' 
    pa = GetProcAddress(lb, "getVersion") 
  
    'Call the getVersion function' 
    retValue = CallWindowProc (pa, Me.hWnd, "I want my version", ByVal 0&amp;, ByVal 0&amp;) 
  
    'release the library' 
    FreeLibrary lb 
  End Sub 
  </code></pre>
  
  <p>Now I want to access public properties of OCX. How I can access (get/set) the properties of OCX?</p>