在VB中有一个Shell函数,在系统的Shell中拟行指定的命令,在很多编程语言中都有这个函数,不知Delphi中与之对应的是什么函数?
解决方案 »
- DELPHI 正则问题
- 如何取到汉字与拼音的对应文件(不要有容错的)
- 对象实例化
- 判断多个普通窗体是否存在的问题
- 我用RAVE5.0制作报表,打印的页面设置和方向总是设置不成功,为什么?
- 存储空间不足此命无法执行
- 问一个TDbcomboBox的问题!!!!!!!!1
- 要如何用ADOExpress建一个表。
- 请问有没有delphi7可用的类似i7风格的tab控件?
- 据调查:90%以上的程序员没有女朋友,这是为什么?怎么办?
- 怎样在Delpi中调用一个Dos命令并将结果输出到一个TMemo中?
- 我在dbgrid中把它的options的dgeidting属情设为false;让它一开始是不能改动的。请问能不能在程序中按一下button1就把它改成true。即可以
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI;type
TConsoleForm = class(TForm)
btOpen: TButton;
btClose: TButton;
btRun: TButton;
btOutput: TButton;
procedure btOpenClick(Sender: TObject);
procedure btCloseClick(Sender: TObject);
procedure btOutputClick(Sender: TObject);
procedure btRunClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
ConsoleForm: TConsoleForm;implementation{$R *.dfm}procedure TConsoleForm.btOpenClick(Sender: TObject);
begin
if not AllocConsole then Application.MessageBox('Can''t allocate console!','Console',MB_OK OR MB_ICONINFORMATION)
else SetConsoleTitle('Console Demo');
end;procedure TConsoleForm.btCloseClick(Sender: TObject);
begin
if not FreeConsole then Application.MessageBox('Can''t free console!','Console',MB_OK OR MB_ICONINFORMATION);
end;procedure TConsoleForm.btOutputClick(Sender: TObject);
var OutText:PChar;nWrite:Cardinal;sHandle:Cardinal;
begin
OutText:='Hello,console!'#$A#$D;
sHandle:=GetStdHandle(STD_OUTPUT_HANDLE);
if (sHandle<>0) then
begin
WriteConsole(sHandle,OutText,StrLen(OutText),nWrite,nil);
end;
end;procedure TConsoleForm.btRunClick(Sender: TObject);
begin
//这里要运行dos的dir命令,并将结果输出到"Open"按钮打开的Console
//Window,怎么写
end;end.