>I have done an EXE-COM, How to register it in Delphi
Maybe the following can get you started. You'll have to replace 
"FileName" with something relevant.
hth Malcolm

type
  TDllRegisterServer = Function():HRESULT;
  TDllUnRegisterServer = Function():HRESULT;

procedure TModule1.RegisterDLLClick(Sender: TObject);
var
  dll : THandle;
  RegServProc : TDllRegisterServer;
begin
  dll := 0;
  OleInitialize(nil);
  try
    dll:=LoadLibrary(pchar(FileName));
    if (not(dll=0)) then
      begin
        RegServProc:=GetProcAddress(dll,'DllRegisterServer');
        if not(@RegServProc=NIL) then
          begin
            if RegServProc() = S_OK then
              ShowMessage('Registration successful')
            else
              ShowMessage('Registration failed');
          end
        else
          ShowMessage('DllRegisterServer not found');
      end
    else
      ShowMessage('LoadLibrary failed');
  finally
    if (not(dll=0)) then FreeLibrary(dll);
    OleUninitialize;
  end;
end;//RegisterDLLClick

procedure TModule1.UnRegisterDLLClick(Sender: TObject);
var
  dll : THandle;
  UnRegServProc : TDllUnRegisterServer;
begin
  dll := 0;
  OleInitialize(nil);
  try
    dll:=LoadLibrary(pchar(FileName));
    if (not(dll=0)) then
      begin
        UnRegServProc:=GetProcAddress(dll,'DllUnregisterServer');
        if not(@UnRegServProc=NIL) then
          begin
            if UnRegServProc() = S_OK then
              ShowMessage('UnRegistration successful')
            else
              ShowMessage('UnRegistration failed');
          end
        else
          ShowMessage('DllUnRegisterServer not found');
      end
    else
      ShowMessage('LoadLibrary failed');
  finally
    if (not(dll=0)) then FreeLibrary(dll);
    OleUninitialize;
  end;
end;//UnregisterDLLClick

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to