포스관련 프로그램을 전혀 해본적이 없어서 업무적인 부분은 잘 모르겠구요
아래 소스가 Delphi7과 델파이2010과 근본적으로 다른것이 하나 있는데요
Delphi7에서는 String이 AnsiString을 나타냅니다.
하지만 Delphi2010에서는 String이 UnicodeString이 됩니다.
소스에서 String이라 선언된 부분은
AnsiString으로 바꿔서 한번 테스트 해보세요
그럼..
디오시 님이 쓰신 글 :
: 이번에 포스관련 카드승인 Sample를 Delphi7소스로 받았습니다.
: 근데 Delphi7에서 컴파일 하면 문제가 없는데 2010에서는 다음 문장이 에러는 없는데 리턴값이 안들어오네요
: 유니코드때문에 문법을 바꿔야 하는거 같습니다.
: NicePosSend(Byte(pchar(ip)),port,Byte(pchar(SndData)),Byte(pchar(SndSignData)),Byte(RecvData));
: 에서 Byte형을 보내기위해 String형을 Byte(PChar(ip)) 여기가 문제인거 같은데 어찌바꿔야 할까요.
: Delphi7실행파일과 2010실행파일 소스도 올려드립니다.
:
: unit Unit1;
:
: interface
:
: uses
: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
: Dialogs, StdCtrls;
:
: type
: TForm1 = class(TForm)
: Edit1: TEdit;
: Label1: TLabel;
: Label2: TLabel;
: Edit2: TEdit;
: Button1: TButton;
: procedure Button1Click(Sender: TObject);
: private
: { Private declarations }
: public
: { Public declarations }
: end;
:
: function NicePosSend(btNiceIP: Byte;iNicePort: integer; sSendData:Byte; sSendSignData: Byte; sReceveData: Byte): integer; stdcall; external 'NicePosV205.dll' name 'Pos_Send';
: var
: Form1: TForm1;
:
: implementation
:
: {$R *.dfm}
:
: procedure TForm1.Button1Click(Sender: TObject);
: var ip: string;
: port: integer;
: SndData: string;
: SndSignData: string;
: RecvData: pchar;
: sRecvData: string;
: aryRecvData: array[0..450] of char;
: nRet: integer;
: Header : String;
: Card : String;
: Pay,Etc : String;
:
: begin
: ip := '211.33.136.1';
: port := 40777;
: nRet := 0;
: FillChar(aryRecvData,Sizeof(aryRecvData),#20);
: RecvData := aryRecvData;
: SndData := '0256TAX23933000020323041054020020H1';
:
: // nRet에서 리턴값이 Delphi7에는 들어오는데 2010에서는 값이 안들어오네요
: nRet := NicePosSend(Byte(pchar(ip)),port,Byte(pchar(SndData)),Byte(pchar(SndSignData)),Byte(RecvData));
|