Link to home
Start Free TrialLog in
Avatar of rbarzallo
rbarzallo

asked on

Runtime 216 y 217

Saludos,
Tengo una aplicacion que reliza una llamada a una dll, la ejecucion se realiza sin problemas, pero al tratar de salir de la aplicacion me devuelve siempre mensajes de error Runtime 216 y 217 y la unica manera de cancelarlo es por medio del task/manager de windows nt.
La aplicacion que estoy utilizando es:

unit Unit2;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Operacion: TEdit;
    Longitud: TEdit;
    Pan: TEdit;
    Pin: TEdit;
    Offset: TEdit;
    Epin: TEdit;
    Tpin: TEdit;
    Resultado: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  function Key_Manager(var Operacion,Longitud,Pan,Pin,Offset,Epin,Tpin,Result_Code : string) : integer; stdcall;

implementation

  function Key_Manager; External 'Key_Manager_Dll.dll' name 'Key_Manager';

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
s : Integer;
s1,s2,s3,s4,s5,s6,s7,s8 : String;
begin

s1 := Operacion.Text;
s2 := Longitud.Text;
s3 := Pan.Text;
s4 := Pin.Text;
s5 := Offset.Text;
s6 := Epin.Text;
s7 := TPin.Text;
s8 := Resultado.Text;

s := Key_Manager(s1,s2,s3,s4,s5,s6,s7,s8);

Operacion.text := Copy(s1,1,2);
Longitud.text  := Copy(s2,1,2);
Pan.text       := Copy(s3,1,16);
Pin.text       := '0000';  //Copy(s4,1,4);
Offset.text    := Copy(s5,1,4);
Epin.text      := Copy(s6,1,16);
TPin.text      := Copy(s7,1,16);
Resultado.text := Copy(s8,1,4);


end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   close;
end;

end.


Agradeceria todos los comentarios que me puedan ayudar a resolver este problema.


Gracias.
ASKER CERTIFIED SOLUTION
Avatar of shenqw
shenqw

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
rbarzallo.. may I know where you are from ?
Avatar of Radler
Radler

Hi rbarzallo,

I saw ( var param_names, ..... : string ) : ResultType;
The called method was made in Delphi too ?( same version ? );
The best pratice is replace the implementation to
DLLMethod( const param_Names, ..... : PChar ) : ResultType;
More details carent your DLL code. And kidding - more points :-)

T++, Radler.
Avatar of rbarzallo

ASKER

Thanks,

I'm from Guayaquil, Ecuador

Saludos