Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Knowledge Base > Code Library > Registering an ActiveX DLL from VB


Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2002, 07:13 AM
divil's Avatar
divil divil is offline
Funky Monkey

* Expert *
 
Join Date: Nov 2001
Location: England
Posts: 1,289
Default Registering ActiveX DLLs from VB


Heres a sub from part of my IDE, to register (or unregister) a COM component, passing the filename:

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 Const ERROR_SUCCESS = &H0 Private Const ERROR_AHHHHHH = &HF Public Function RegisterServer(hwnd As Long, DllServerPath As String, bRegister As Boolean) As Boolean On Error Resume Next Dim lb As Long, pa As Long lb = LoadLibrary(DllServerPath) If bRegister Then pa = GetProcAddress(lb, "DllRegisterServer") Else pa = GetProcAddress(lb, "DllUnregisterServer") End If If CallWindowProc(pa, hwnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then RegisterServer = True Else RegisterServer = False End If FreeLibrary lb End Function
__________________
MVP, C#
Now you see why evil will always triumph - because good is dumb.
Windows Forms and WPF user interface controls

Last edited by lebb; 01-27-2003 at 07:07 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->