关于SHOWWINDOW()的问题? (20分)

  • 主题发起人 主题发起人 易名烦
  • 开始时间 开始时间

易名烦

Unregistered / Unconfirmed
GUEST, unregistred user!
是这样的,我用FINDWINDOW找到一个窗口的句柄,想用SHOWWINDOW把我个窗口显示出来,<br>但是SHOWWINDOW(参数1,参数2),参数二我全都试完了,只有最大化才能显示出来,但<br>是我想以默认大小显示出来,请大家帮我,XIEXIE!<br>win2000 advanced server +delphi6
 
SHOWWINDOW(参数1,0)<br><br>试试,我忘了,好象是吧
 
不行,我试过了,后面是1也不行,!
 
SW_SHOWDEFAULT &nbsp;or SW_SHOWNORMAL
 
showwindow(窗口句柄,显示方式);<br>窗口句柄,没问题吧?<br>显示方式有:<br>SW_HIDE SW_MAXIMIZE &nbsp;SW_MINIMIZE &nbsp;SW_SHOWNOACTIVATE <br>SW_RESTORE &nbsp;SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED<br>SW_SHOWMINIMIZED &nbsp;SW_SHOWMINNOACTIVE &nbsp; &nbsp;SW_SHOWNA &nbsp;SW_SHOWNORMAL
 
不行,我上面讲了,只有最大化才能显示,其它都不行!
 
Maybe you are wrong.<br>There are no reason &nbsp;about what you have said!
 
我是这样写的,看对不对:<br>&nbsp;IF NOT(FINDWINDOW(NIL,'订单导入')&lt;&gt;0) THEN<br>&nbsp; &nbsp; shellexecute(handle,nil,pchar(INI.ReadString('TOOLS','SJJZ','')),nil,nil,0)<br>&nbsp;ELSE<br>&nbsp; &nbsp; BEGIN<br>&nbsp; &nbsp; &nbsp;S:=FINDWINDOW(NIL,'订单导入');<br>&nbsp; &nbsp; &nbsp;SHOWWINDOW(S,SW_SHOWDEFAULT);<br>&nbsp; &nbsp; END;
 
showWindow(handle,sw_show);<br>
 
还是不行?<br>要把它显示出来的只有最大化才行,隐藏到是可以?
 
订单导入 是否顶端窗口?他的父窗口是否隐藏,而他是子窗口?<br><br>另外,你的代码虽然没什么错误,不过有点罗嗦<br><br>S:=FINDWINDOW(NIL,'订单导入');<br>IF s=0 THEN<br>&nbsp; &nbsp; shellexecute(handle,nil,pchar(INI.ReadString('TOOLS','SJJZ','')),nil,nil,0)<br>&nbsp;ELSE <br>&nbsp; &nbsp; SHOWWINDOW(S,SW_NORMAL);<br><br>SW_NORMAL试了?<br>
 
订单导入是用VFP写的段程序,它的父窗口是隐藏了的,但父窗口的CAPTION也是"订单导入"<br>子窗口也是,还是不行!我的目的就是要从不是顶端变成顶端!
 
我将你的代码略加修改(请先启动'记事本'),我试验过了,没问题:<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp;H:HWND;<br>begin<br>&nbsp;H:=FINDWINDOW(NIL,'未定标题 - 记事本');<br>&nbsp;IF H=0<br>&nbsp; THEN &nbsp;Showmessage('Can''t find!')<br>&nbsp; &nbsp; //shellexecute(handle,nil,pchar(INI.ReadString('TOOLS','SJJZ','')),nil,nil,0)<br>&nbsp; ELSE BEGIN<br>&nbsp; &nbsp; &nbsp;H:=FINDWINDOW(NIL,'未定标题 - 记事本');<br>&nbsp; &nbsp; &nbsp;SHOWWINDOW(H,SW_Hide);<br>&nbsp; &nbsp; &nbsp;SHOWWINDOW(H,SW_ShowDefault);<br>&nbsp; &nbsp;END;<br>end;<br>
 
to DarwinZhang:<br>&nbsp; &nbsp;thank you very much!<br>&nbsp; &nbsp;再问一下,为什么先HIDE,再SHOW就可以了呢?<br>&nbsp; &nbsp;我直接SHOW为什么不行?<br>&nbsp; &nbsp;还有就是最大化就可以先不HIDE呢?
 
因为SHOWWINDOW(H,SW_ShowDefault);只是将该窗口设置为该进程的窗口的最前面,<br>先将窗口Hide,当窗口Show时,Windows就会把这个进程的窗口的放到最前面,并且该<br>窗口位于该进程的窗口的最前面.<br>
 
谢谢各位,特别是:DaR老师!
 
后退
顶部