Registrar dll con Apis (para Guido)
Publicado por Pere (150 intervenciones) el 07/10/2004 19:26:33
Buenas Guido. El siguiente ejemplo ya lo puse, no sé cuando, en este foro. Por si no lo encuentras, te lo vuelvo a poner.
Un saludo.
En un módulo .bas escribe:
Public Declare Function RegDllOcx Lib "Shdocvw.dll" Alias "DllRegisterServer" () As Long
Public Declare Function UnRegDllOcx Lib "Imgscan.ocx" Alias "DllUnregisterServer" () As Long
' Sustituye Shdocvw.dll o Imgscan.ocx por lo que te interese
Public Const S_OK = &H0
Y en el formulario que quieras, esto otro:
RegistrarDllOcx ' Si quieres registrarla
NoRegistrarDllOcx ' Si quieres quitarla del registro
Public Sub RegistrarDllOcx()
On Error GoTo Err_Registration_Failed
If RegDllOcx = S_OK Then
MsgBox "Registro realizado"
Else
MsgBox "NO Registrado"
End If
Exit Sub
Err_Registration_Failed:
MsgBox "Error: " & Err.Number & " " & Err.Description
End Sub
Public Sub NoRegistrarDllOcx()
On Error GoTo Err_Unregistration_Failed
If UnRegDllOcx = S_OK Then
MsgBox "Quitado del registro"
Else
MsgBox "NO quitado del registro"
End If
Exit Sub
Err_Unregistration_Failed:
MsgBox "Error: " & Err.Number & " " & Err.Description
End Sub
' Como puedes ver sirve tanto para una Dll como para un Ocx
Un saludo.
En un módulo .bas escribe:
Public Declare Function RegDllOcx Lib "Shdocvw.dll" Alias "DllRegisterServer" () As Long
Public Declare Function UnRegDllOcx Lib "Imgscan.ocx" Alias "DllUnregisterServer" () As Long
' Sustituye Shdocvw.dll o Imgscan.ocx por lo que te interese
Public Const S_OK = &H0
Y en el formulario que quieras, esto otro:
RegistrarDllOcx ' Si quieres registrarla
NoRegistrarDllOcx ' Si quieres quitarla del registro
Public Sub RegistrarDllOcx()
On Error GoTo Err_Registration_Failed
If RegDllOcx = S_OK Then
MsgBox "Registro realizado"
Else
MsgBox "NO Registrado"
End If
Exit Sub
Err_Registration_Failed:
MsgBox "Error: " & Err.Number & " " & Err.Description
End Sub
Public Sub NoRegistrarDllOcx()
On Error GoTo Err_Unregistration_Failed
If UnRegDllOcx = S_OK Then
MsgBox "Quitado del registro"
Else
MsgBox "NO quitado del registro"
End If
Exit Sub
Err_Unregistration_Failed:
MsgBox "Error: " & Err.Number & " " & Err.Description
End Sub
' Como puedes ver sirve tanto para una Dll como para un Ocx
Valora esta pregunta


0