有3个exe文件:exe1是主程序;exe2是分程序2;exe3是分程序3。
在exe1中输入4个信息:xx1,xx2,xx3
exe1根据xx1的内容调用exe2或exe3,并将xx2和xx3传入exe2和exe3请问:(1)exe之间如何传递参数
(2)被调用的exe如何定义接收到的参数
(3)exe1调用exe2后如何自动关闭我刚学习delphi不久,请大家多帮忙。
在exe1中输入4个信息:xx1,xx2,xx3
exe1根据xx1的内容调用exe2或exe3,并将xx2和xx3传入exe2和exe3请问:(1)exe之间如何传递参数
(2)被调用的exe如何定义接收到的参数
(3)exe1调用exe2后如何自动关闭我刚学习delphi不久,请大家多帮忙。
解决方案 »
- 调用vc写的dll出现内存访问错误
- CXGRID动态显示隐藏列
- dbgrid显示数据问题
- 把普通字符转化成ASCII码,用到函数ASC()的问题!
- 求教,做图像的网络传输,用indy的idtcpserver方便还是tcpserver方便?请给出理由。
- 使用指针返回结果的VC DLL的调用方法?(急,在线等待)
- 怎么才能将一个文件(exe,word,excel)写入数据库(SQL)
- 如何判断DOC文档当前是否正在被使用啊?
- 请问在delphi中得到一个文件的大小的函数应该怎么写或是哪一个函数?在线等待!
- TStream 写文件 中文乱码
- 一个关于网络访问时Socket Error的问题
- 怎样获得dxDBTreeView当前节点的 KeyField 值
uses ShellApi;
...
ShellExecute(Handle, ’open’,
’c:\Windows\notepad.exe’, nil, nil, SW_SHOWNORMAL); 第4位可输入你要传的参数
s:= ParamStr(1); (3)exe1调用exe2后如何自动关闭
Application.Terminate;
先在Exe1中判断xxx1是要调用Exe2或Exe3
if xxx1 = 'exe2' then
begin
Exe2 := Texe2.Create(Application);
.......
Exe1.Hide;
......
EXE2.FREE;
end;
这样不就可以了吗?不管是Exe2,exe3都可以调用xxx2,xxx3
其实这样也就是在窗口之间传递参数。
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function sum(x,y:integer):integer;stdcall; external 'project1.dll';
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(IntToStr(sum(12,20)));
end;end.
被调用程序(dll):
library Project1;uses
SysUtils,
Classes;{$R *.res}
function sum(x,y : integer):integer;stdcall;
begin
result := x + y;
end;
exports sum;
begin
end.
============================
上面只是最简单的示例,建议楼主多看看书:)
============================
jinjazz(近身剪(充电中...))