想通过以下代码实现,先运行一个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
求大家教我如何修改以上代码实现以上代码。
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
求大家教我如何修改以上代码实现以上代码。
1、如何修改IE的安全级别,为了下载ACTIVEX,以及如何修改系统的字体。
2、知道文件夹的frmis\data\frdb.mdb,如何找到他在哪里,如C:\frmis\data\frdb.mdb或d:\soft\frmis\data\frdb.mdb,找出路径。
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 FindFilebegin // 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.這個只能在某个分區中找到**.***文件不能找到文件夾
ShellExecute(0,nil,pchar(ss),0,0 ,SW_SHOWNORMAL );用這個代替winexec看看啦