<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff size=2>Here
ya' go. Found this on the web. To use it, just paste all the code below the line
into a module. Then, run the code:</FONT></SPAN></DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff size=2>call
RegDLL("c:\winnt\system32\COMDLG32.OCX",TRUE). </FONT></SPAN></DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff size=2>You
can put any dll file in there you want. Include the path.</FONT></SPAN></DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff size=2>Place
a true or false in there if you want a message box to show
up.</FONT></SPAN></DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff size=2>John
Skolits</FONT></SPAN></DIV>
<DIV><SPAN class=552391518-02102003><FONT face=Arial color=#0000ff
size=2>_____________________________________________</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2><FONT face=Arial color=#0000ff>Option Compare
Database</FONT></FONT></DIV>
<DIV> </DIV>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2><FONT face=Arial color=#0000ff>Option Explicit</FONT></FONT></DIV>
<DIV> </DIV>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2><FONT face=Arial color=#0000ff>Private Declare Function LoadLibraryA
Lib "kernel32" (ByVal lLibFileName As String) As Long<BR>Private Declare
Function CreateThread Lib "kernel32" (lThreadAttributes As Any,
_<BR> ByVal lStackSize As Long, ByVal lStartAddress As Long,
ByVal larameter As Long, _<BR> ByVal lCreationFlags As Long,
lThreadID As Long) As Long<BR>Private Declare Function WaitForSingleObject Lib
"kernel32" (ByVal hHandle As Long, _<BR> ByVal lMilliseconds
As Long) As Long<BR>Private Declare Function GetProcAddress Lib "kernel32"
(ByVal hModule As Long, _<BR> ByVal lProcName As String) As
Long<BR>Private Declare Function CallWindowProc Lib "user32" Alias
"CallWindowProcA" _<BR> (ByVal lpPrevWndFunc As Long, ByVal
hwnd As Long, ByVal Msg As Long, _<BR> ByVal wParam As Long,
ByVal lParam As Long) As Long<BR>Private Declare Function FreeLibrary Lib
"kernel32" (ByVal hLibModule As Long) As Long<BR>Private Declare Function
CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<BR>Private Declare
Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lExitCode As
Long) As Long<BR>Private Declare Sub ExitThread Lib "kernel32" (ByVal
lExitCode As Long)</FONT></FONT></DIV>
<DIV> </DIV>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2><FONT face=Arial color=#0000ff>Function RegDLL(strDLL_Name As String,
Optional bolShowMsg As Boolean)<BR> If
RegisterComponent(strDLL_Name) = True
Then<BR> If bolShowMsg Then MsgBox
"Component Successfully Registered"<BR>
Else<BR> If bolShowMsg Then MsgBox
"Failed to Registered Component"<BR> End If<BR>End
Function</FONT></FONT></DIV>
<DIV> </DIV><FONT face=Tahoma size=2><FONT face=Arial color=#0000ff>
<DIV class=OutlookMessageHeader dir=ltr align=left><BR>'Purpose
: This function registers and Unregisters OLE
components<BR>'Inputs :
sFilePath The path to the DLL/OCX or
ActiveX
EXE<BR>'
bRegister
If True Registers the
control,<BR>'
else unregisters control<BR>'Outputs : Returns
True if successful<BR>'Author :
Andrewb<BR>'Date :
04/09/2000<BR>'Notes : This is the
API equivalent of RegSvr32.exe.<BR>'Revisions : 1/Jan/2002.
Updated to include code for registering ActiveX Exes.</DIV>
<DIV> </DIV>
<DIV class=OutlookMessageHeader dir=ltr align=left>Function
RegisterComponent(ByVal sFilePath As String, Optional bRegister As Boolean =
True) As Boolean<BR> Dim lLibAddress As Long, lProcAddress
As Long, lThreadID As Long, _<BR>
lSuccess As Long, lExitCode As Long, lThread As Long<BR> Dim
sRegister As String<BR> Const clMaxTimeWait As Long =
20000 'Wait 20 secs for register to
complete<BR> <BR> On Error GoTo
ErrFailed<BR> If Len(sFilePath) > 0 And
Len(Dir(sFilePath)) > 0 Then<BR>
'File exists<BR> If
UCase$(Right$(sFilePath, 3)) = "EXE"
Then<BR>
'Register/Unregister ActiveX
EXE<BR> If
bRegister
Then<BR>
'Register
EXE<BR>
Shell sFilePath & " /REGSERVER",
vbHide<BR>
Else<BR>
'Unregister ActiveX
EXE<BR>
Shell sFilePath & " /UNREGSERVER",
vbHide<BR>
End If<BR>
RegisterComponent = True<BR>
Else<BR>
'Register/Unregister
DLL<BR> If
bRegister
Then<BR>
sRegister =
"DllRegisterServer"<BR>
Else<BR>
sRegister =
"DllUnRegisterServer"<BR>
End If<BR>
<BR> 'Load
library into current
process<BR>
lLibAddress =
LoadLibraryA(sFilePath)<BR>
<BR> If
lLibAddress
Then<BR>
'Get address of the DLL
function<BR>
lProcAddress = GetProcAddress(lLibAddress,
sRegister)<BR>
If lProcAddress
Then<BR>
lThread = CreateThread(ByVal 0&, 0&, ByVal lProcAddress, ByVal 0&,
0&,
lThread)<BR>
If lThread
Then<BR>
'Created thread and wait for it to
terminate<BR>
lSuccess = (WaitForSingleObject(lThread, clMaxTimeWait) =
0)<BR>
If Not lSuccess
Then<BR>
'Failed to register, close
thread<BR>
Call GetExitCodeThread(lThread,
lExitCode)<BR>
Call
ExitThread(lExitCode)<BR>
RegisterComponent =
False<BR>
Else<BR>
'Successfully registered
component<BR>
RegisterComponent =
True<BR>
Call
CloseHandle(lThread)<BR>
End
If<BR>
End
If<BR>
Call
FreeLibrary(lLibAddress)<BR>
Else<BR>
'Object doesn't expose OLE
interface<BR>
Call
FreeLibrary(lLibAddress)<BR>
End If<BR>
End If<BR> End
If<BR> End If<BR> Exit Function</DIV>
<DIV> </DIV>
<DIV class=OutlookMessageHeader dir=ltr
align=left>ErrFailed:<BR> Debug.Print
Err.Description<BR> Debug.Assert False<BR>
On Error GoTo 0<BR>End
Function<BR></FONT></DIV></FONT></BLOCKQUOTE></BODY></HTML>