窗体焦点问题(100分)

  • 主题发起人 baixuefeng
  • 开始时间
B

baixuefeng

Unregistered / Unconfirmed
GUEST, unregistred user!
在我的主窗体里有多个按钮,每个按钮都show一个窗体(不是子窗体)<br>现在要实现:<br>在按某个按钮时,如果对应窗体处于未激活状态则激活。否则将之最小化。<br><br>请教各位了
 
(1)isiconic这个api函数可以判断是不是最小化<br>(2) if form1=nil then<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;form1:=tform1.create(application) &nbsp; <br>&nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp;else<br><br>&nbsp; &nbsp; &nbsp; &nbsp;form1.show<br><br>在form的close事件中 要写入<br>form1:=nil;<br><br>(3)用发送WM_ACTIVATE消息来处理
 
SetForegroundWindow 这个函数可以把后面的窗体拉到前面来
 
上面的朋友说得很清楚了,给分把
 
查询窗口的函数:<br>Function FindForm(FormName:String):Boolean;<br>Var<br>&nbsp; &nbsp; &nbsp;i:integer;<br>begin<br>&nbsp; &nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp; &nbsp;for i:=0 to screen.Formcount-1 do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if screen.forms.Name = formname &nbsp;then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; result:=true;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>end;<br>
 
感谢各位的答复。可惜未能解决我的问题。<br>其实我要实现的就是windows任务栏的功能:<br>&nbsp;以IE窗口为例,打开多个IE窗口,任务栏出现多个按钮。点某个按钮时,如果对应窗口<br>&nbsp;是非活动状态(未在最前端),则激活。如果已在最前端,则最小化,并且变为非活动<br>&nbsp;状态。<br>相信这次我说的很清楚了。
 
多人接受答案了。
 
顶部