如何使一个从DLL创建的窗口,成为当前活动窗口? (15分)

  • 主题发起人 主题发起人 touip
  • 开始时间 开始时间
T

touip

Unregistered / Unconfirmed
GUEST, unregistred user!
一任务栏程序,点击图标,loadlibrary,生成一个FORM,当此FORM不是当前窗口时,<br>我如何使它成为当前活动窗口,比如当我点击图标时或弹出菜单时?
 
FindWindow<br>ShowWindow
 
to netfool:<br>&nbsp; &nbsp;if CheckIdDll=0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;CheckIdDll:=LoadLibrary('***.dll');<br>&nbsp; &nbsp; &nbsp; &nbsp;...<br>&nbsp; &nbsp;end<br>&nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; showwindow(checkIDDLL, SW_SHOW);<br>&nbsp; &nbsp;<br>无效?
 
哦,奇怪!<br>你的CheckIdDll对不对啊?怎样得到的啊?
 
CheckIdDll:=LoadLibrary('***.dll');<br>如果关闭此出口,freelibrary后,CHECKIDDLL:=0;<br>你说对不对?
 
请详细看看ShowWindows这个函数,你搞错了!<br><br>
代码:
<br>var<br>&nbsp; Handle: THandle;<br>begin<br>&nbsp; Handle = FindWindow(...);<br>&nbsp; ShowWindow(Handle,...)<br>end;<br>
 
VAR CHECKIDDLL: THANDLE;<br>我也试过:<br>&nbsp; &nbsp; var check: thandle;<br>&nbsp; &nbsp; &nbsp; check := findwindow(窗口类名,窗口名);<br>&nbsp; &nbsp; &nbsp; showWindow(check, SW_SHOW);<br>但是还是达不到效果?
 
System: win2000<br><br>showWindow(check, SW_SHOWMAXIMIZED); &nbsp; //It's Max,but the form is not Active.<br><br>why?!
 
用setforegroundWindow行不行?
 
后退
顶部