VB如何隐藏两个相同的窗体
比如说,我打开了两个“计算器”窗口,并且这两个窗口都处于可见 状态,现在我要用VB写个程序,实现点击COMMAND1以后,两个“计算器”窗口同时被隐藏。退出程序时,两个窗口同时恢复可见。不知道如何操作?只有一个窗体的情况下,我已经测试成功。[ 本帖最后由 msxjc 于 2011-4-25 14:43 编辑 ]
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Sub Form_Load() Const SCICALL As String = "SciCalc" Dim lret As Long lret = FindWindow(SCICALL, vbNullString) Do While lret Debug.Print "SciCalc", Hex$(lret) lret = FindWindowEx(0, lret, SCICALL, vbNullString) Loop End Sub