PDA

Click to See Complete Forum and Search --> : Registering ocx


Nov 29th, 2000, 01:24 PM
I have some workstations that will register and some that dont. It seems that there is somthing missing from the workststion like a dll.

I used the following code..

Option Explicit
Private Declare Function DllRegisterServer Lib "nwdir.ocx" () As Long
Private Declare Function DllUnregisterServer Lib "nwdir.ocx" () As Long
Const ERROR_SUCCESS = &H0


Private Sub Command1_Click()
If DllRegisterServer = ERROR_SUCCESS Then
MsgBox "Registration Successful"
Else
MsgBox "Registration Unsuccessful"
End If

End Sub

Private Sub Command2_Click()
If DllUnregisterServer = ERROR_SUCCESS Then
MsgBox "UnRegistration Successful"
Else
MsgBox "UnRegistration Unsuccessful"
End If

End Sub

On the machines that will not register I get a runtime error 48 but on other machines it works fine. The ocx is in the system dir. Mix of win95 and win98

Nov 29th, 2000, 02:16 PM
In order for the DllRegisterServer and DllUnregisterServer api function to work, you have to have regsvr32.exe on your computer, hopefully in the C:\Windows\System directory.

Perhaps some of the workstations are missing that file?

Nov 30th, 2000, 07:19 PM
Out of date mfc42.dll. Thanks for the help though.

parksie
Dec 1st, 2000, 02:22 PM
Matthew - you don't need to have regsvr32.exe...the functions are both stored in the .ocx file.

All that regsvr32.exe does is to call either of those functions.