Call RegisterTypeLibForUser not working - any ideas?

This is really a question from the previous one , where do I need to register applications, TLB and OCX for each user, and not in HKLM. I wrote the following code based on the answers here and elsewhere, but the TLB is not registered - no error occurs, just nothing happens (this piece of code comes from the Embarcadero website .

procedure RegisterTypeLibrary(TypeLib: ITypeLib; const ModuleName: string);
var
  Name: WideString;
  HelpPath: WideString;
  RegisterTypeLibForUser : function(tlib: ITypeLib; szFullPath, szHelpDir: POleStr): HResult; stdcall;
  res : HResult;
begin
  Name := ModuleName;
  HelpPath := ExtractFilePath(ModuleName);
  res:=RegisterTypeLib(TypeLib, PWideChar(Name), PWideChar(HelpPath));
  if res <> S_OK then begin
    @RegisterTypeLibForUser:=GetProcAddress(GetModuleHandle('oleaut32.dll'), 'RegisterTypeLibForUser');
    if (@RegisterTypeLibForUser <> nil) then begin
      res:=RegisterTypeLibForUser(TypeLib, PWideChar(Name), PWideChar(HelpPath));
    end;
  end;
  //MessageBox(GetForegroundWindow, PChar(IntToHex(res, 8)), nil, MB_OK);
  OleCheck(res);
end;

Everyone has some kind of pointers, since I'm lost.

Update:

Thanks for all the help and suggestions, so check ...

, , , , . (, , ), , .

admin, (, , ), , . , ? , regsvr32, - , OCX.

+3
2

reg, QC ( ), .

+3

Vista Win7.

-Edit -
, , RegisterTypeLib IS "", . , .

0

Source: https://habr.com/ru/post/1738306/


All Articles