Delphi中调用ShellExecuteEx为何在运行时出错,而VB以同样方法调用却能成功?(50分)

  • 主题发起人 主题发起人 蓝冰
  • 开始时间 开始时间

蓝冰

Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码编译通过,可是在运行时却出现错误,为什么?<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; info:ShellExecuteInfo;<br>begin<br>&nbsp; info.cbSize := SizeOf(ShellExecuteInfo);<br>&nbsp; info.Wnd &nbsp;:= Handle;<br>&nbsp; info.lpVerb := 'print';<br>&nbsp; info.lpFile := 'D:/YouDriveMeCrazy.txt';<br>&nbsp; info.nShow := SW_SHOWNORMAL;<br>&nbsp; info.fMask := SEE_MASK_NOCLOSEPROCESS;<br>&nbsp; ShellExecuteEx(@info);<br>end;
 
以下代码编译通过,可是在运行时却出现错误,为什么?<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; info:ShellExecuteInfo;<br>begin<br>&nbsp; // &nbsp;***************************************<br>&nbsp; FillChar(Info, SizeOf(Info), 0);<br>&nbsp; // &nbsp;***************************************<br>&nbsp; info.cbSize := SizeOf(ShellExecuteInfo);<br>&nbsp; info.Wnd &nbsp;:= Handle;<br>&nbsp; info.lpVerb := 'print';<br>&nbsp; info.lpFile := 'D:/YouDriveMeCrazy.txt';<br>&nbsp; info.nShow := SW_SHOWNORMAL;<br>&nbsp; info.fMask := SEE_MASK_NOCLOSEPROCESS;<br>&nbsp; ShellExecuteEx(@info);<br>end;
 
同意楼上的
 
后退
顶部