不如直接把它隐藏了吧。。一个简单的例子:'模块中: Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public 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 Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Public Const SW_HIDE = 0 Public Const SW_SHOW = 5'程序中:Dim hwd As Long Private Sub Command1_Click() DataReport1.Show DoEvents Dim s As String * 256 hwd = FindWindow("ThunderDFrame", "datareport1") Print hwd hwd = FindWindowEx(hwd, 0, "MSDataReportRuntimeWndClass6.0", vbNullString) Print hwd hwd = FindWindowEx(hwd, 0, "REPT_DISPLAYFRAME", vbNullString) Print hwd hwd = FindWindowEx(hwd, 0, "#32770", vbNullString) Print hwd hwd = FindWindowEx(hwd, 0, "Button", "扩展") Print hwd i% = GetWindowText(hwd, s, 256) Print s End SubPrivate Sub Command2_Click() If Command2.Caption = "隐藏" Then ShowWindow hwd, SW_HIDE Command2.Caption = "显示" Else ShowWindow hwd, SW_SHOW Command2.Caption = "隐藏" End If End Sub Private Sub Form_Load() Command2.Caption = "隐藏" End Sub 运行程序,先按command1,出现datareport 再按command2,可控制导出按钮的显示或隐藏。 在实际应用中可以再作适当的处理。。
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5'程序中:Dim hwd As Long
Private Sub Command1_Click()
DataReport1.Show
DoEvents
Dim s As String * 256
hwd = FindWindow("ThunderDFrame", "datareport1")
Print hwd
hwd = FindWindowEx(hwd, 0, "MSDataReportRuntimeWndClass6.0", vbNullString)
Print hwd
hwd = FindWindowEx(hwd, 0, "REPT_DISPLAYFRAME", vbNullString)
Print hwd
hwd = FindWindowEx(hwd, 0, "#32770", vbNullString)
Print hwd
hwd = FindWindowEx(hwd, 0, "Button", "扩展")
Print hwd
i% = GetWindowText(hwd, s, 256)
Print s
End SubPrivate Sub Command2_Click()
If Command2.Caption = "隐藏" Then
ShowWindow hwd, SW_HIDE
Command2.Caption = "显示"
Else
ShowWindow hwd, SW_SHOW
Command2.Caption = "隐藏"
End If
End Sub
Private Sub Form_Load()
Command2.Caption = "隐藏"
End Sub
运行程序,先按command1,出现datareport
再按command2,可控制导出按钮的显示或隐藏。
在实际应用中可以再作适当的处理。。