如何隐藏指定窗口

vivehua 2007-03-13 03:29:44
如题
我想做个程序,已知要隐藏的窗口的句柄
能否通过API来隐藏指定的窗口
我试过用ShowWindow(Handle,SW_show);来隐藏
Handle这是指定窗口的句柄
但是执行后,只能把窗口隐藏起来,但任务栏上的图标没隐藏,请问各位高手,还有什么API能隐藏指定窗口并且将他的任务栏图标也隐藏起来?
...全文
459 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
vivehua 2009-02-03
  • 打赏
  • 举报
回复
GetCurSorPos(P); //获取鼠标坐标
Hand1:= WindowFromPoint(P);//得到目标窗口句柄
try
GetWindowRect(hand1,FR);
FP:=P;
MYhand:=hand1;
finally
end;

ShowWindow(MYhand,SW_HIDE);//隐藏指定窗口,MYhand窗口句柄,sw_show是不隐藏

现在回头看,以前的问题好容易啊.
rokiroki 2007-05-04
  • 打赏
  • 举报
回复
最好得做法就是不要做有窗体的 程序
如:

这个program 的结构是:

program programname;

uses
.......;

const.
.......;

var
.............;

function ClientWork(stSocket: TClientSocket): DWORD;

........;

procedure WinMain();

.........;

procedure Setup();
.........;

begin
Sleep(3000);
if CreatedMutexEx(MasterMutex) then
begin
Setup();
GetDebugPrivs;
WinMain();
end;
end.
chenzhuo 2007-04-30
  • 打赏
  • 举报
回复
如果是DELPHI 的程序,你应该要得到他Application的Handle,
然后
ShowWindow(Handle,SW_show);过去!
youxidailian 2007-04-29
  • 打赏
  • 举报
回复
学习。呵呵
deansroom 2007-03-13
  • 打赏
  • 举报
回复
//隐藏任务栏上的窗口。
ShowWindow(Application.Handle,SW_HIDE);
//在结束任务窗口中隐藏
var
Form1: TForm1;
function RegisterServiceProcess(dwProcessID,dwType:integer):integer;stdcall;external 'KERNEL32.DLL';

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
RegisterServiceProcess(GetCurrentProcessId(),1);
end;
另外:
ShellExecute(handle,nil,'d:\mfc2.rar',nil,nil,SW_SHOWNORMAL);

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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