解决方案 »
- 大家帮我看看,代码出问题了。
- actionlist问题:)
- 两个单元相互引用好不好?
- 与总工和2003年度Borland产品专家面对面---广告,没兴趣就不要看了
- 静儿有delphi问题需要帮助QQ:9813117
- rxPlacemnt.dcu找不到
- 关于dbgrid的问题,诚心请教。
- 汇出excel的简单问题--在线等
- 用DELPHI做的程序,如果不做特别处理,启动后,不关闭,然后在“开始”菜单里重起计算机,发现该delphi程序不能自动关闭,从而windows也无法重起。请问,我怎样使程序自动关闭呢?
- 有一点点难度的问题!
- 头疼中...Win7(Vista)的bug?怎么绕过去?
- xml BULK LOAD 到数据库中
h: THandle;
prevInst: THandle;
begin
(*******单实例模式*********)
h := CreateMutex(nil, True, CNT_APPLICATION_NAME);
if (GetLastError = ERROR_ALREADY_EXISTS) or (h = 0) then
begin
prevInst := FindWindow(nil, CNT_APPLICATION_NAME);
If prevInst<>0 then
if isiconic(prevInst)then
ShowWindow(prevInst,SW_RESTORE)
ELSE
SetForegroundWindow(prevInst);
Exit;
end;
(***********单实例模式*********)
uses
Forms,Windows,
Unit1 in 'Unit1.pas' {Form1},
wdRunOnce in 'wdRunOnce.pas';{$R *.res}var
h: THandle;
prevInst: THandle;
begin Application.Initialize;
h := CreateMutex(nil, True, 'Form1');
if (GetLastError = ERROR_ALREADY_EXISTS) or (h = 0) then
begin
prevInst := FindWindow(nil, 'Form1');
If prevInst<>0 then
if isiconic(prevInst)then
ShowWindow(prevInst,SW_RESTORE)
ELSE
SetForegroundWindow(prevInst);
Exit;
end;
//if not AppHasRun(Application.Handle) then
Application.CreateForm(TForm1, Form1);
Application.Run;
end.我只是想在现在基础上.不知.怎么.在元件里.激活已经隐藏到托盘和窗体
begin
prevInst := FindWindow(nil, 'Form1');
If prevInst<>0 then
if isiconic(prevInst)then
ShowWindow(prevInst,SW_RESTORE)
ELSE
SetForegroundWindow(prevInst);//改為sendmessage(prevInst,mousemsg,0,0)
Exit;
end;