我希望打开'd:\playcap.exe'外部可执行文件,并让它一直在顶部显示。我如下操作
ShellExecute(Handle,'open',PChar('d:\playcap.exe'),nil,nil,SW_SHOW);
f:=findwindow(nil,'video capture previewer');
if not f=0 then
begin
a:=setwindowpos(f,HWND_TOP,10,10,50,50,SWP_NOZORDER);
if a then
showmessage('set ok')
else showmessage('set false');
end;
但是setwindowpos(f,HWND_TOP,10,10,50,50,SWP_NOZORDER);语句一直不执行,不知道为什么??
我的API函数有用错吗?还有其他的方法吗?SWP_NOZORDER设置是否正确呢???
急!!!
ShellExecute(Handle,'open',PChar('d:\playcap.exe'),nil,nil,SW_SHOW);
f:=findwindow(nil,'video capture previewer');
if not f=0 then
begin
a:=setwindowpos(f,HWND_TOP,10,10,50,50,SWP_NOZORDER);
if a then
showmessage('set ok')
else showmessage('set false');
end;
但是setwindowpos(f,HWND_TOP,10,10,50,50,SWP_NOZORDER);语句一直不执行,不知道为什么??
我的API函数有用错吗?还有其他的方法吗?SWP_NOZORDER设置是否正确呢???
急!!!
你可以使用Spy++来查看某个窗体的类的名称。然后查找的时候,就直接使用FindWindow的第一个参数,第二个参数设为nil。
后
Sleep()一段时间再
FindWindow()
SetWindowPos()
我用这种方法运行了计算器程序并更改了标题兰和图标
试一试,看是否有效
前面的参数应该是你的窗体的名称吧
前面的参数应该是你的窗体的名称吧