Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Que libreria de la Unit Utils es compatible con Delphi 12.2 (https://www.clubdelphi.com/foros/showthread.php?t=97990)

lgarcia 13-02-2026 13:09:09

Que libreria de la Unit Utils es compatible con Delphi 12.2
 
Hola: Estoy migrando un proyecto de Delphi 7 a Delphi 12.2 donde uso los componentes de DevExpress y especialmente el dxBar el cual se relaciona con la Unit Utils, en Deplhi 7 todo corría perfectamente pero cuando lo compilo ahora me da este error en esa Unit:

Cita:

initialization
dxUnitsLoader.AddUnit(@RegisterAssistants, @UnregisterAssistants);

finalization
FreeAndNil(FLookAndFeelClickController);
dxUnitsLoader.RemoveUnit(@UnregisterAssistants);

end.
y estos son los mensajes de error que me tira el compilador:

[dcc32 Error] Utils.pas(497): E2010 Incompatible types: 'Cardinal' and 'Pointer'
[dcc32 Error] Utils.pas(497): E2010 Incompatible types: 'string' and 'Pointer'
[dcc32 Error] Utils.pas(501): E2010 Incompatible types: 'Cardinal' and 'Pointer'
[dcc32 Fatal Error] AppBase.pas(34): F2063 Could not compile used unit 'Utils.pas'

Saludos
Luis Garcia

Suave para que se te de

Neftali [Germán.Estévez] 13-02-2026 15:22:14

Prueba a llamarlas sin los @.

Código Delphi [-]
dxUnitsLoader.AddUnit(RegisterAssistants, UnregisterAssistants);
dxUnitsLoader.RemoveUnit(UnregisterAssistants);

Si no funciona, revisa las units en DevExpress o la ayuda a ver cual es la sintaxis nueva de esas funciones.

emailx45 21-10-2026 20:16:38

Código:

// DevExpress 25.2.4

// TdxProc = procedure;

//  { HMODULEs can be used in place of HINSTs }  = CARDINAL / NATIVEINT (platform dependent 32/64bits) =  0..4294967295 - 0..18446744073709551615
// HMODULE = System.HMODULE;   

procedure TdxUnitsLoader.AddUnit(AInstance: HMODULE; const AUnitName: string; const AInitializeProc, AFinalizeProc: TdxProc);
//
procedure TdxUnitsLoader.RemoveUnit(AInstance: HMODULE; const AUnitName: string; const AFinalizeProc: TdxProc);
//

procedure Hello; // no params
begin
 // your code here
end;

xxxx.AddUnit(
  Handle {form1.Handle or another HMODULE value like Application.Handle, etc... },
  'unit-name-here',
  Hello {or NIL if you does not use it - your anonymous proc here},
  nil { if doesnt used }
);


procedure TForm2.Button1Click( Sender: TObject );
var
  x: TdxUnitsLoader;
  C: Cardinal;  //0..4294967295;
  NI:NativeUInt; //0..4294967295; ... in 64bits = 18446744073709551615
begin
  Memo1.Text:=  C.MaxValue.ToString + '  -  ' +  NI.MaxValue.ToString;
  //
  x := TdxUnitsLoader.Create;
  x.AddUnit( handle, 'unitname', nil, nil );
  //
  x.RemoveUnit(handle, 'unitname', nil);
end;



La franja horaria es GMT +2. Ahora son las 11:06:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi