一个winexec的问题?

xh416 2004-08-27 08:44:45
想通过以下代码实现,先运行一个EXE文件,再提示用户重启电脑。(fr_remot.exe是B/S结构的中间件,主要起注册COM作用)
winexec(pchar('d:\fire_xxx\remote\fr_remot.exe'),SW_SHOWMINIMIZED);//SW_HIDE,SW_SHOWNOACTIVATE,SW_SHOWMINIMIZED,SW_SHOWMINNOACTIVE,SW_SHOWNOACTIVATE
if application.MessageBox('系统将重启电脑?(Y/N)'),'系统提示',52)<>6 then exit;
ExitWindowsEx(EWX_REBOOT,0);
第一行可以运行这个EXE文件,可我想让其最小化或隐藏,其可以运行但不能最小化,以致于我的提示窗口被挡住。(winexec的第二个参数我试了第一行的后面几个都不行)
第三行,我想让电脑重启,可电脑不能重启(ExitWindowsEx(EWX_LOGOFF,0)可以注销电脑),我的电脑是WINDOWS2000
求大家教我如何修改以上代码实现以上代码。
...全文
238 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2004-08-28
  • 打赏
  • 举报
回复
本来只有自己回复的帖子可以删掉而不扣信誉,并返回可用分的
唉...
给我点分吧~
xh416 2004-08-28
  • 打赏
  • 举报
回复
大家时来顶一下,不然不能结分!
xh416 2004-08-28
  • 打赏
  • 举报
回复
谢谢大家了,有人回答就可以结分了!
Allblus 2004-08-28
  • 打赏
  • 举报
回复
ss:=shoesoftpath+'\shoedwg\'+form9.Label2.Caption+'.dwg';
ShellExecute(0,nil,pchar(ss),0,0 ,SW_SHOWNORMAL );

用這個代替winexec看看啦
Allblus 2004-08-28
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry, ComCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button5: TButton;
ListBox1: TListBox;
ProgressBar1: TProgressBar;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button5Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function FindFile(const filespec: TFileName; attributes: integer
= faReadOnly Or faHidden Or faSysFile Or faArchive): TStringList;
end;
var
Form1: TForm1;
count0:integer;
implementation

{$R *.dfm}
//////////////////////////
function tform1.FindFile(const filespec: TFileName;
attributes: integer): TStringList;
var
spec: string;
list: TStringList;
procedure RFindFile(const folder: TFileName);
var
SearchRec: TSearchRec;
begin
// Locate all matching files in the current
// folder and add their names to the list
if FindFirst(folder + spec, attributes, SearchRec)=0 then begin
try
repeat
if (SearchRec.Attr and faDirectory = 0) or
(SearchRec.Name<>'.') and (SearchRec.Name<>'..') then
list.Add(folder + SearchRec.Name);
until FindNext(SearchRec) <> 0;
except
FindClose(SearchRec);
raise;
end;
FindClose(SearchRec);
end;
// Now search the subfolders
if FindFirst(folder + '*', attributes
Or faDirectory, SearchRec) = 0 then
begin
try
repeat
if ((SearchRec.Attr and faDirectory) <> 0) and
(SearchRec.Name<>'.') and (SearchRec.Name<>'..') then
RFindFile(folder + SearchRec.Name + '\');
until FindNext(SearchRec) <> 0;
except
FindClose(SearchRec);
raise;
end;
FindClose(SearchRec);
end;
end; // procedure RFindFile inside of FindFile

begin // function FindFile
list := TStringList.Create;
try
spec := ExtractFileName(filespec);
RFindFile(ExtractFilePath(filespec));
Result := list;
except
list.Free;
raise;
end;
end;


procedure TForm1.Button5Click(Sender: TObject);
var
list: TStringList;
str:string;
i:integer;
begin
str:=form1.ComboBox1.Text + edit1.Text;
list := FindFile(str);
listbox1.Items.Assign(list);
if listbox1.Count = 0 then
messagedlg('the file not exsit!',mtinformation,[mbok],0);
list.Free;
end;

end.

這個只能在某个分區中找到**.***文件不能找到文件夾
Allblus 2004-08-28
  • 打赏
  • 举报
回复
2、知道文件夹的frmis\data\frdb.mdb,如何找到他在哪里,如C:\frmis\data\frdb.mdb或d:\soft\frmis\data\frdb.mdb,找出路径。

這個我這裡有。等下貼出來
xh416 2004-08-27
  • 打赏
  • 举报
回复
自已给自已顶!
xh416 2004-08-27
  • 打赏
  • 举报
回复
这个问题我解决了,为了结分,提如下问题吧:
1、如何修改IE的安全级别,为了下载ACTIVEX,以及如何修改系统的字体。
2、知道文件夹的frmis\data\frdb.mdb,如何找到他在哪里,如C:\frmis\data\frdb.mdb或d:\soft\frmis\data\frdb.mdb,找出路径。

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧