Ver Mensaje Individual
  #6  
Antiguo 21-11-2006
Avatar de acertij022
acertij022 acertij022 is offline
Miembro
 
Registrado: may 2003
Ubicación: Argentina-Bs. As.
Posts: 233
Reputación: 22
acertij022 Va por buen camino
hola de nuevo realice pruebas en otra pc e incluso desintale el windows xp y coloque windows 2000 y sigue el problema.

Para hacer mas simple cree una dll:
Código Delphi [-]
library Project2;

uses
  SysUtils,
  Classes;

{$R *.res}

function sumar(a,b:shortstring):string;stdcall;
begin
Result:= IntToSTr(StrToInt(a)+StrToInt(b));
end;

Exports sumar;
begin
end.

y una aplicacion que suma usando la DLL:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
function sumar(a,b:shortstring):string; stdcall; external 'Project2.dll';

procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption :=  sumar(edit1.Text,edit2.Text);
end;

end.

pero al cliquear en el botón realiza la suma pero coloca un cartel de error:
Invalid pointer operation

Por lo visto hay algo basico que hago mal
Espero que alguien me tire un cable por favor
Responder Con Cita