这是在vc动态库中的声明
class OSDDLL_API COSDDLL {
public:
COSDDLL(void);
// TODO: add your methods here.
};
extern OSDDLL_API int nOSDDLL;
OSDDLL_API BOOL OpenConnection(WORD dwPort);
OSDDLL_API BOOL SetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL SetInitCharModel(unsigned char totallen,unsigned char index, unsigned char * model);
我在delphi中是这样声明的
Function OpenConnection(dwPort:word): Bool;stdcall;external 'OSDDLL.dll'name 'OpenConnection';
Function SetOsdTime(TIMESTRUCT* tm): Bool;stdcall;external 'OSDDLL.dll'name 'SetOsdTime';
上面那个引用参数怎么改? Function SetInitCharModel(unsigned char totallen,unsigned char index, unsignedchar * model): Bool;stdcall;external 'OSDDLL.dll'name SetInitCharModel';
上面那个指针参数怎么改?
implementation
uses Unit2, Unit3, Unit4, Unit5;
{$R *.dfm}
procedure TForm1.Button8Click(Sender: TObject);
var
Rego:Tregistry;
nindex:integer;
begin
Rego:=Tregistry.Create;
Rego.RootKey:=HKEY_USERS;
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Dset',False);
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Iset',False) ;
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Tset',False) ;
rego.Free;
case combobox3.ItemIndex of
1:SetOsdTime()
2:GetOsdTime()
3:SetInitCharModel()
end
end;
procedure TForm1.Button7Click(Sender: TObject);
var
nCom:word;
begin
if Combobox1.ItemIndex= 0
then
nCom:=0
else
nCom:=1;
if OpenConnection(ncom)
then
ShowMessage('open') 到这儿就死机了,光标能用,但按不动按钮?
else
raise EcomInvalid.Create('com error');
// else CloseConnection(0,9600);
end;
end.
class OSDDLL_API COSDDLL {
public:
COSDDLL(void);
// TODO: add your methods here.
};
extern OSDDLL_API int nOSDDLL;
OSDDLL_API BOOL OpenConnection(WORD dwPort);
OSDDLL_API BOOL SetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL SetInitCharModel(unsigned char totallen,unsigned char index, unsigned char * model);
我在delphi中是这样声明的
Function OpenConnection(dwPort:word): Bool;stdcall;external 'OSDDLL.dll'name 'OpenConnection';
Function SetOsdTime(TIMESTRUCT* tm): Bool;stdcall;external 'OSDDLL.dll'name 'SetOsdTime';
上面那个引用参数怎么改? Function SetInitCharModel(unsigned char totallen,unsigned char index, unsignedchar * model): Bool;stdcall;external 'OSDDLL.dll'name SetInitCharModel';
上面那个指针参数怎么改?
implementation
uses Unit2, Unit3, Unit4, Unit5;
{$R *.dfm}
procedure TForm1.Button8Click(Sender: TObject);
var
Rego:Tregistry;
nindex:integer;
begin
Rego:=Tregistry.Create;
Rego.RootKey:=HKEY_USERS;
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Dset',False);
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Iset',False) ;
Rego.OpenKey('.DEFAULT\Software\AngelSoft\Tset',False) ;
rego.Free;
case combobox3.ItemIndex of
1:SetOsdTime()
2:GetOsdTime()
3:SetInitCharModel()
end
end;
procedure TForm1.Button7Click(Sender: TObject);
var
nCom:word;
begin
if Combobox1.ItemIndex= 0
then
nCom:=0
else
nCom:=1;
if OpenConnection(ncom)
then
ShowMessage('open') 到这儿就死机了,光标能用,但按不动按钮?
else
raise EcomInvalid.Create('com error');
// else CloseConnection(0,9600);
end;
end.
PTIMESTRUCT=^TIMESTRUCT;Function SetOsdTime(tm:PTIMESTRUCT): Bool;stdcall;external 'OSDDLL.dll'name 'SetOsdTime';
Function SetInitCharModel(totallen,index:Byte;model:PChar): Bool;stdcall;external 'OSDDLL.dll'name SetInitCharModel';
Function GetDeviceID(unsigned char& id1,unsigned char& id2): Bool;stdcall;external 'OSDDLL.dll'name 'GetDeviceID; 这个参数怎么改?