Dll을 사용할라고 하는 소쓰 입니당...
--------------------------------------------------------
unit Unit1;
interface
Function SC_Open(Baud:Integer; port:Integer):Integer; cdecl;
Function SC_Close():Integer;cdecl;
Function CardPowerOn(Recv:String):Integer; cdecl;
Function CardPowerOff(Recv:String):Integer; cdecl;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
Function SC_Open; external 'VtModule.dll' name 'SC_Open';
Function SC_Close; external 'VtModule.dll' name 'SC_Close';
Function CardPowerOn; external 'VtModule.dll' name 'CardPowerOn';
Function CardPowerOff; external 'VtModule.dll' name 'CardPowerOff';
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := '양종일';
end;
end.
---------------------------------------------
근데여..
[Error] Unit1.pas(8): Declaration expected but 'USES' found
[Error] Unit1.pas(13): Undeclared identifier: 'TForm'
[Error] Unit1.pas(14): Undeclared identifier: 'TButton'
[Error] Unit1.pas(15): Undeclared identifier: 'TEdit'
[Error] Unit1.pas(36): Missing operator or semicolon
[Error] Unit1.pas(36): Statement expected, but expression of type 'String' found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
냐하하! 무식하게 다 올립니당...
에러가...
지가 델 왕초보걸랑려...
부
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Function SC_Open(Baud:Integer; port:Integer):Integer; cdecl; external 'VtModule.dll'
Function SC_Close():Integer;cdecl; external 'VtModule.dll'
Function CardPowerOn(Recv:String):Integer; cdecl; external 'VtModule.dll'
Function CardPowerOff(Recv:String):Integer; cdecl; external 'VtModule.dll'
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := '양종일';
end;
end.
이렇게 선언하세요.. 간단하죠?
글쿠 반드시 VtModule.dll은 프로그램이 실행되는 디렉토리 안이나 시스템 디렉토리에 있어야 합니다. 그럼..
냐하하.. wrote:
> Dll을 사용할라고 하는 소쓰 입니당...
> --------------------------------------------------------
> unit Unit1;
>
> interface
> Function SC_Open(Baud:Integer; port:Integer):Integer; cdecl;
> Function SC_Close():Integer;cdecl;
> Function CardPowerOn(Recv:String):Integer; cdecl;
> Function CardPowerOff(Recv:String):Integer; cdecl;
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
> StdCtrls;
>
> type
> TForm1 = class(TForm)
> Button1: TButton;
> Edit1: TEdit;
> procedure Button1Click(Sender: TObject);
> private
> { Private declarations }
> public
> { Public declarations }
> end;
>
> var
> Form1: TForm1;
>
> implementation
> Function SC_Open; external 'VtModule.dll' name 'SC_Open';
> Function SC_Close; external 'VtModule.dll' name 'SC_Close';
> Function CardPowerOn; external 'VtModule.dll' name 'CardPowerOn';
> Function CardPowerOff; external 'VtModule.dll' name 'CardPowerOff';
>
> {$R *.DFM}
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Edit1.Text := '양종일';
> end;
>
> end.
> ---------------------------------------------
> 근데여..
>
> [Error] Unit1.pas(8): Declaration expected but 'USES' found
> [Error] Unit1.pas(13): Undeclared identifier: 'TForm'
> [Error] Unit1.pas(14): Undeclared identifier: 'TButton'
> [Error] Unit1.pas(15): Undeclared identifier: 'TEdit'
> [Error] Unit1.pas(36): Missing operator or semicolon
> [Error] Unit1.pas(36): Statement expected, but expression of type 'String' found
> [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
>
> 냐하하! 무식하게 다 올립니당...
> 에러가...
> 지가 델 왕초보걸랑려...
> 부