这是在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 CloseConnection(WORD dwPort, DWORD dwBaudRate);
OSDDLL_API BOOL SetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL GetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL SetInitCharModel(unsigned char totallen,unsigned char index, unsi
gned char * model);
OSDDLL_API BOOL SetDynamicCharModel(unsigned char totallen,unsigned char index, u
nsigned char * model);
OSDDLL_API BOOL SetInitDispInfo(unsigned char index, unsigned char xpos,
unsigned char ypos,unsigned char blink,unsigned char backfill,unsigned char si
ze);
OSDDLL_API BOOL SetDynamicDispInfo(unsigned char index, unsigned char xpos,
unsigned char ypos,unsigned char blink,unsigned char backfill,unsigned char si
ze);
OSDDLL_API BOOL DelInitCharModel();
OSDDLL_API BOOL DelDynamicCharModel();
OSDDLL_API BOOL DelInitDispInfo();
OSDDLL_API BOOL DelDynamicDispInfo(unsigned char line); //0xff means delete all
OSDDLL_API BOOL SetDeviceID(unsigned char id1,unsigned char id2,BOOL bWriteDevice
);
OSDDLL_API BOOL GetDeviceID(unsigned char& id1,unsigned char& id2);
OSDDLL_API BOOL SetTimeFormat(unsigned char format,unsigned char xpos,unsigned ch
ar ypos);我在delphi中是这样声明的 Function OpenConnection(dwPort:word): Bool;stdcall;external 'OSDDLL.dll'name '?O
penConnection@@YAHG@Z';
Function CloseConnection(dwPort:WORD;dwBaudRate:DWORD): Bool;stdcall;external '
OSDDLL.dll'name '?CloseConnection@@YAHGK@Z';
{Function SetOsdTime(TIMESTRUCT* tm):
上面那个引用参数怎么改?Bool;stdcall;external 'OSDDLL.dll'name '?SetOsdTime@@YAHPAU_TIMESTRUCT@@@Z';
Function GetOsdTime(TIMESTRUCT* tm): Bool;stdcall;external 'OSDDLL.dll'name '?G
etOsdTime@@YAHPAU_TIMESTRUCT@@@Z';
Function SetInitCharModel(unsigned char totallen,unsigned char index, unsigned
char * model): Bool;stdcall;external 'OSDDLL.dll'name '?SetInitCharModel@@YAHEEPA
E@Z';
Function SetDynamicCharModel(unsigned char totallen,unsigned char index, unsign
ed char * model): Bool;stdcall;external 'OSDDLL.dll'name '?SetDynamicCharModel@@Y
AHEEPAE@Z';
Function SetInitDispInfo(unsigned char index, unsigned char xpos,unsigned char
ypos,unsigned char blink,unsigned char backfill,unsigned char size): Bool;stdcall
;external 'OSDDLL.dll'name '?SetInitDispInfo@@YAHEEEEEE@Z';
Function SetDynamicDispInfo(unsigned char index, unsigned char xpos,unsigned ch
ar ypos,unsigned char blink,unsigned char backfill,unsigned char size): Bool;stdc
all;external 'OSDDLL.dll'name '?SetDynamicDispInfo@@YAHEEEEEE@Z';
Function DelInitCharModel(): Bool;stdcall;external 'OSDDLL.dll'name '?DelInitCh
arModel@@YAHXZ';
Function DelDynamicCharModel(): Bool;stdcall;external 'OSDDLL.dll'name '?DelDyn
amicCharModel@@YAHXZ;
}Function DelInitDispInfo(): Bool;stdcall;external 'OSDDLL.dll'name '?DelInitDi
spInfo@@YAHXZ';
Function DelDynamicDispInfo(line: Pchar): Bool;stdcall;external 'OSDDLL.dll'nam
e '?DelDynamicDispInfo@@YAHE@Z';
{Function SetDeviceID(unsigned char id1,unsigned char id2,BOOL bWriteDevice): B
ool;stdcall;external 'OSDDLL.dll'name '?SetDeviceID@@YAHEEH@Z';
Function GetDeviceID(unsigned char& id1,unsigned char& id2): ): 上面那个指针参数怎么改?Bool;stdcall;external 'OSDDLL.dll'name '?GetDeviceID@@YAHAAE0@Z';
Function SetTimeFormat(unsigned char format,unsigned char xpos,unsigned char yp
os): Bool;stdcall;external 'OSDDLL.dll'name '?SetTimeFormat@@YAHEEE@Z'; } function GetChineseLattice(ChineseText: String; out LatticeData: array of char;
Style: Integer): Boolean; stdcall;far;external 'Lattices.dll'
implementationuses 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) ;
//Label1.Caption:=rego.ReadString('sx');
//Label2.Caption:=IntToStr(Rego.ReadInteger('sy'));
rego.Free;
{ case combobox3.ItemIndex of
1:SetOsdTime()
2:GetOsdTime()
3:SetInitCharModel()
4:SetDynamicCharModel()
5:SetInitDispInfo()
6:SetDynamicDispInfo()
7:DelInitCharModel()
8:SetDynamicDispInfo()
9:DelDynamicCharModel()
10:DelInitDispInfo()
11:SetDeviceID()
12:DelDynamicDispInfo()
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 CloseConnection(WORD dwPort, DWORD dwBaudRate);
OSDDLL_API BOOL SetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL GetOsdTime(TIMESTRUCT* tm);
OSDDLL_API BOOL SetInitCharModel(unsigned char totallen,unsigned char index, unsi
gned char * model);
OSDDLL_API BOOL SetDynamicCharModel(unsigned char totallen,unsigned char index, u
nsigned char * model);
OSDDLL_API BOOL SetInitDispInfo(unsigned char index, unsigned char xpos,
unsigned char ypos,unsigned char blink,unsigned char backfill,unsigned char si
ze);
OSDDLL_API BOOL SetDynamicDispInfo(unsigned char index, unsigned char xpos,
unsigned char ypos,unsigned char blink,unsigned char backfill,unsigned char si
ze);
OSDDLL_API BOOL DelInitCharModel();
OSDDLL_API BOOL DelDynamicCharModel();
OSDDLL_API BOOL DelInitDispInfo();
OSDDLL_API BOOL DelDynamicDispInfo(unsigned char line); //0xff means delete all
OSDDLL_API BOOL SetDeviceID(unsigned char id1,unsigned char id2,BOOL bWriteDevice
);
OSDDLL_API BOOL GetDeviceID(unsigned char& id1,unsigned char& id2);
OSDDLL_API BOOL SetTimeFormat(unsigned char format,unsigned char xpos,unsigned ch
ar ypos);我在delphi中是这样声明的 Function OpenConnection(dwPort:word): Bool;stdcall;external 'OSDDLL.dll'name '?O
penConnection@@YAHG@Z';
Function CloseConnection(dwPort:WORD;dwBaudRate:DWORD): Bool;stdcall;external '
OSDDLL.dll'name '?CloseConnection@@YAHGK@Z';
{Function SetOsdTime(TIMESTRUCT* tm):
上面那个引用参数怎么改?Bool;stdcall;external 'OSDDLL.dll'name '?SetOsdTime@@YAHPAU_TIMESTRUCT@@@Z';
Function GetOsdTime(TIMESTRUCT* tm): Bool;stdcall;external 'OSDDLL.dll'name '?G
etOsdTime@@YAHPAU_TIMESTRUCT@@@Z';
Function SetInitCharModel(unsigned char totallen,unsigned char index, unsigned
char * model): Bool;stdcall;external 'OSDDLL.dll'name '?SetInitCharModel@@YAHEEPA
E@Z';
Function SetDynamicCharModel(unsigned char totallen,unsigned char index, unsign
ed char * model): Bool;stdcall;external 'OSDDLL.dll'name '?SetDynamicCharModel@@Y
AHEEPAE@Z';
Function SetInitDispInfo(unsigned char index, unsigned char xpos,unsigned char
ypos,unsigned char blink,unsigned char backfill,unsigned char size): Bool;stdcall
;external 'OSDDLL.dll'name '?SetInitDispInfo@@YAHEEEEEE@Z';
Function SetDynamicDispInfo(unsigned char index, unsigned char xpos,unsigned ch
ar ypos,unsigned char blink,unsigned char backfill,unsigned char size): Bool;stdc
all;external 'OSDDLL.dll'name '?SetDynamicDispInfo@@YAHEEEEEE@Z';
Function DelInitCharModel(): Bool;stdcall;external 'OSDDLL.dll'name '?DelInitCh
arModel@@YAHXZ';
Function DelDynamicCharModel(): Bool;stdcall;external 'OSDDLL.dll'name '?DelDyn
amicCharModel@@YAHXZ;
}Function DelInitDispInfo(): Bool;stdcall;external 'OSDDLL.dll'name '?DelInitDi
spInfo@@YAHXZ';
Function DelDynamicDispInfo(line: Pchar): Bool;stdcall;external 'OSDDLL.dll'nam
e '?DelDynamicDispInfo@@YAHE@Z';
{Function SetDeviceID(unsigned char id1,unsigned char id2,BOOL bWriteDevice): B
ool;stdcall;external 'OSDDLL.dll'name '?SetDeviceID@@YAHEEH@Z';
Function GetDeviceID(unsigned char& id1,unsigned char& id2): ): 上面那个指针参数怎么改?Bool;stdcall;external 'OSDDLL.dll'name '?GetDeviceID@@YAHAAE0@Z';
Function SetTimeFormat(unsigned char format,unsigned char xpos,unsigned char yp
os): Bool;stdcall;external 'OSDDLL.dll'name '?SetTimeFormat@@YAHEEE@Z'; } function GetChineseLattice(ChineseText: String; out LatticeData: array of char;
Style: Integer): Boolean; stdcall;far;external 'Lattices.dll'
implementationuses 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) ;
//Label1.Caption:=rego.ReadString('sx');
//Label2.Caption:=IntToStr(Rego.ReadInteger('sy'));
rego.Free;
{ case combobox3.ItemIndex of
1:SetOsdTime()
2:GetOsdTime()
3:SetInitCharModel()
4:SetDynamicCharModel()
5:SetInitDispInfo()
6:SetDynamicDispInfo()
7:DelInitCharModel()
8:SetDynamicDispInfo()
9:DelDynamicCharModel()
10:DelInitDispInfo()
11:SetDeviceID()
12:DelDynamicDispInfo()
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. 请帮忙赐教.
解决方案 »
- 差哪呢?任凭不好?在XP下D7调用DXE的DLL就是不成呢?
- 请前辈赐教一个服务的写法,谢谢
- delphi 拿到了图像的缓冲数据myBuffer 如何用SetDIBitsToDevice把图像显示出来
- delphi QReport 如何实现报表打印 请大虾们一定帮帮忙啊,这个问题困扰我很久了!
- 关于撤销menggirl版主的通告
- 在大富翁上提了几天无人接招,现在在这边提了!
- 请问DELPHI5+PRODOX7如何批量删除数据库中的记录?
- fastreport的问题一切都搞好了, 但是关闭主程序的时候, 出现 invaild pointer
- 客户端怎样知道服务器是否正常运行
- 如何在控件内部创建窗体?
- 请问如何得到在系统中注册的,各种文件类型对应的图标
- 如何实现一个目录的备份?
#define OSDDLL_API extern "C" __declspec(dllexport)