Enregistrer une dll sans regserver

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 - 20 déc. 2002 à 16:20
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 - 20 déc. 2002 à 17:53
Bonjour à tous

Je sais que beaucoup de monde ont posé la question : comment enregistrer un dll, mais j'aimerais pouvoir enregistrer une dll sans passer par l'éternel Regsvr32.exe. N'existe-t-il pas une api pour faire ca par hasard ?

Merci d'avance à tout ceux qui répondront

DARK SIDIOUS

6 réponses

AraXeen Messages postés 36 Date d'inscription mardi 3 décembre 2002 Statut Membre Dernière intervention 24 juin 2004
20 déc. 2002 à 16:28
J'ai trouvé ça dans API-Guide, peut être que ça peut te servir

' Add 2 Commandbuttons and a textbox to the form, and paste this code into the form
Option Explicit

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 Sub Form_Load()
Text1.Text = "C:\WINDOWS\SYSTEM\COMCTL32.OCX"
Command1.Caption = "Register server"
Command2.Caption = "Unregister server"
End Sub

Private Sub Command1_Click()
Call RegisterServer(Me.hWnd, Text1.Text, True)
End Sub

Private Sub Command2_Click()
Call RegisterServer(Me.hWnd, Text1.Text, False)
End Sub

Public Function RegisterServer(hWnd As Long, DllServerPath As String, bRegister As Boolean)
On Error Resume Next

'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'We're going to call an API-function, without declaring it!

' Modified by G. Kleijer
' gkleijer@casema.net
' going to call the DllRegisterServer/DllUnRegisterServer API of the specified library.
' there's no need to use the Regsvr32.exe anymore.

' Make sure the path is correct and that the file exists, otherwise VB will crash.

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
MsgBox IIf(bRegister = True, "Registration", "Unregistration") + " Successful"
Else
MsgBox IIf(bRegister = True, "Registration", "Unregistration") + " Unsuccessful"
End If
'unmap the library's address
FreeLibrary lb
End Function

AraXeen
stefsoft Messages postés 119 Date d'inscription lundi 15 avril 2002 Statut Membre Dernière intervention 28 novembre 2008
20 déc. 2002 à 16:30
Declare Function DllRegisterServer Lib "ComCtl32.OCX" () As Long
Declare Function DllUnregisterServer Lib "ComCtl32.OCX" () As Long

Const ERROR_SUCCESS = &H0

' To register your OCX use this function:
If DllRegisterServer = ERROR_SUCCESS Then
MsgBox "Registration Successful"
Else
MsgBox "Registration Unsuccessful"
End If

' To unregister your OCX use this function:
If DllUnregisterServer = ERROR_SUCCESS Then
MsgBox "UnRegistration Successful"
Else
MsgBox "UnRegistration Unsuccessful"
End If
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 131
20 déc. 2002 à 16:38
Merci beaucoup à tout les deux pour votre aide rapide et précieuse !!!

DARK SIDIOUS
gilardh Messages postés 70 Date d'inscription mercredi 21 août 2002 Statut Membre Dernière intervention 22 février 2008
20 déc. 2002 à 17:14
Bonjour,

A quoi cela peux t il servir de "DllUnregisterServer" la DLL ?

Regards

gilardh

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
gilardh Messages postés 70 Date d'inscription mercredi 21 août 2002 Statut Membre Dernière intervention 22 février 2008
20 déc. 2002 à 17:17
Apparement pour enregistrer une DLL ou un OCX , il suffit de rajouter "$(DLLSelfRegister)" dans le fichier "SETUPE.lst" de l'installation.

Quelqu'un peux t il me le confirmer ?

Exemple :

Avant :
File1=@CMDLGFR.DLL,$(WinSysPath),,$(Shared),7/12/98 11:00:00 PM,32768,6.0.81.63

Aprés:
File1=@CMDLGFR.DLL,$(WinSysPath),$(DLLSelfRegister),$(Shared),7/12/98 11:00:00 PM,32768,6.0.81.63

Regards

gilardh
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 131
20 déc. 2002 à 17:53
Réponse à gilardh : Ben si tu efface le fichier dll, autant l'effacer également de la base de registre...

DARK SIDIOUS
Rejoignez-nous