Dim i As Long For i = 0 To Forms.Count - 1 If Forms(i) Is <YourWindowName> Then <YourWindowName>.ZOrder 0 '将其显示出来 Exit Sub End If Next
修正: Exit For (Not 'Exit Sub')
Public Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Long) As Longhwnd 是窗口的句柄。如果是自己的窗口可以直接使用myform.hwnd,否则续通过findwindow或者遍历所有的窗口(gettopwindow,getnextwindow)得到窗体的caption(getwindowtext)来判断是否是自己所要查找的窗体。
IsWindowVisible函数有如下说明: If the specified window and its parent window do not have the WS_VISIBLE style, the return value is zero. Because the return value specifies whether the window has the WS_VISIBLE style, it may be nonzero even if the window is totally obscured by other windows. 所以我怀疑这个函数的实际作用是否可实现这位兄弟的要求。
用GetActiveWindow判断这个窗口是否激活窗口算了吧
为什么还要得标题??? if GetActiveWindow()=Form?.Hwnd then 不就行了吗?
For i = 0 To Forms.Count - 1
If Forms(i) Is <YourWindowName> Then
<YourWindowName>.ZOrder 0 '将其显示出来
Exit Sub
End If
Next
If the specified window and its parent window do not have the WS_VISIBLE style, the return value is zero. Because the return value specifies whether the window has the WS_VISIBLE style, it may be nonzero even if the window is totally obscured by other windows. 所以我怀疑这个函数的实际作用是否可实现这位兄弟的要求。
if GetActiveWindow()=Form?.Hwnd then
不就行了吗?
无论如何谢谢大家给出这么多方法!!!thank!!!
'hidden
else
dim rct as rect
r=getwindowrect (rct)
endif