首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

关于形参和实参不一致的有关问题

2012-02-11 
关于形参和实参不一致的问题procedure TMainForm.Button9Click(Sender: TObject)vars: integer begins :

关于形参和实参不一致的问题
procedure TMainForm.Button9Click(Sender: TObject);
var
  s: integer ;
begin
  s := strtoint(ComboBox8.Text)*32 + strtoint(ComboBox9.Text) ;
  if ComboBox8.Text='' then
  begin
  ShowMessage('Please select Projector ID');
  exit;
  end;
  if not switchchanel_video(s,4,'')//这里报错
  then ShowMessage('Divide error');
end;
这个是用来调用DLL的
声明如下
function switchchanel_video(maxinputchannel,maxoutputchannel:integer; var sendstring:pchar):integer;stdcall;
function switchchanel_video;stdcall; external DLLName;


这到底怎么不一致了啊 最后一个参数我要为空

[解决办法]
if not switchchanel_video(s,4,nil)

试试?
[解决办法]
换成 NIL 还错?
[解决办法]
定义一个临时变量 将它复制为空 然后传这个变量到函数里

procedure TMainForm.Button9Click(Sender: TObject);
var
s: integer ;
tmpp: PChar;
begin
tmpp := PChar('');
s := strtoint(ComboBox8.Text)*32 + strtoint(ComboBox9.Text) ;
if ComboBox8.Text='' then
begin
ShowMessage('Please select Projector ID');
exit;
end;
if not switchchanel_video(s,4,tmpp )
then ShowMessage('Divide error');
end;

热点排行