我现在要编一个汇编语言的开发工具,遇到如下问题:
1). 怎样在delphi中操作dos命令?
2). 怎样取得dos是的提示信息, 如:执行masm.exe a.asm;后如何得到以下的返回信息?Microsoft (R) Macro Assembler Version 5.00
Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved.
50434 + 449790 Bytes symbol space free 0 Warning Errors
0 Severe Errors请各位老兄多多指教!
1). 怎样在delphi中操作dos命令?
2). 怎样取得dos是的提示信息, 如:执行masm.exe a.asm;后如何得到以下的返回信息?Microsoft (R) Macro Assembler Version 5.00
Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved.
50434 + 449790 Bytes symbol space free 0 Warning Errors
0 Severe Errors请各位老兄多多指教!
解决方案 »
- [急]关于OleContainer控制excel权限的问题
- QReport打印多份时,如何记录打印份数的序号??
- TcpClient为什么不触发TcpClient1Receive事件?
- 请问如何确定一个字符在ComboBox中的ItemIndex?
- 最后总分,慷慨求解囊,属性中显示并可以编辑TForm类型变量了
- Eof 的 例外问题!急!!
- 动态创建StringGrid,如何使某一列居中。分多
- 做过KTV点歌系统的朋友请进!(请各位好心的大富翁帮帮忙吧。要分要RMB都可以商量)
- 大家评论一下C/S、B/S,还有三层结构都各具什么优点和缺点?
- 请问利用udp如何实现数据的传送
- excel表中数据如何导入sqlserver2000数据库中,急急急!!不甚感激;;
- 想要在delphi里动态创建access数据库,然后立即创建数据表,该如何做?
var
SecAttr: TSecurityAttributes;
const
PIPE_SIZE = 0; //--was: 1024;
begin
SecAttr.nLength := SizeOf(SecAttr);
SecAttr.lpSecurityDescriptor := nil;
SecAttr.bInheritHandle := true; with FPipeInput do
begin
if not CreatePipe(hRead, hWrite, @SecAttr, PIPE_SIZE)
then WinError('Error on STDIN pipe creation : ');
if not DuplicateHandle(GetCurrentProcess, hRead, GetCurrentProcess,
@hRead, 0, true, DUPLICATE_CLOSE_SOURCE or DUPLICATE_SAME_ACCESS)
then WinError('Error on STDIN pipe duplication : ');
end;
with FPipeOutput do
begin
if not CreatePipe(hRead, hWrite, @SecAttr, PIPE_SIZE)
then WinError('Error on STDOUT pipe creation : ');
if not DuplicateHandle(GetCurrentProcess, hWrite, GetCurrentProcess,
@hWrite, 0, true, DUPLICATE_CLOSE_SOURCE or DUPLICATE_SAME_ACCESS)
then WinError('Error on STDOUT pipe duplication : ');
end;
with FPipeError do
begin
if not CreatePipe(hRead, hWrite, @SecAttr, PIPE_SIZE)
then WinError('Error on STDERR pipe creation : ');
if not DuplicateHandle(GetCurrentProcess, hWrite, GetCurrentProcess,
@hWrite, 0, true, DUPLICATE_CLOSE_SOURCE or DUPLICATE_SAME_ACCESS)
then WinError('Error on STDERR pipe duplication : ');
end;
end;设置标准输入输出
StartupInfo.wShowWindow := FShowWindow;
StartupInfo.hStdInput := FPipeInput.hRead;
StartupInfo.hStdOutput := FPipeOutput.hWrite;
StartupInfo.hStdError := FPipeError.hWrite;用建立进程
CreateProcess(szExecutable, szCommandline, nil, nil, true,
(CREATE_DEFAULT_ERROR_MODE and Integer(FDefaultErrorMode))
or (CREATE_SUSPENDED and Integer(FStartSuspended) or liPriorityClass),
Environment, szDirectory, StartupInfo, FProcessInfo)
然后读程序输出结果
if PeekNamedPipe(FRedirector.FPipeOutput.hRead, nil, 0, nil,
@FRedirector.FAvailable, nil) and (FRedirector.FAvailable > 0) then
begin
Synchronize(FRedirector.ReadStdOutput);
Idle := false;
end; //-- check for StdErr-Pipe
if PeekNamedPipe(FRedirector.FPipeError.hRead, nil, 0, nil,
@FRedirector.FAvailable, nil) and (FRedirector.FAvailable > 0) then
begin
Synchronize(FRedirector.ReadStdError);
Idle := false;
end;