现在有另外一个程序运行了,已知他的一个按钮是隐藏,并且我已通过其他方法获得了这个隐藏的按钮的句柄,请问我要怎么才能将他显示出来,我看了一些文章说用SENDMESSAGE来操作,但是我却不成功,请问有哪位高人能教教我用SENDMESSAGE要怎么设置参数,还要注意哪些?还有就是除了SENDMESSAGE,还有其他的方法吗?

解决方案 »

  1.   

    WM_SHOWWINDOW消息或用SHOWWINDOW这个API。
      

  2.   

    SHOWWINDOW(你取得的句柄,SW_SHOWNORMAL)
      

  3.   

    ShowWindow Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long 说明 
       控制窗口的可见性(在vb里使用:针对vb窗体及控件,请使用对应的vb属性) 
    返回值 
       Long,如窗口之前是可见的,则返回TRUE(非零),否则返回FALSE(零) 
    参数表 
       参数     类型及说明 
      hwnd      Long,窗口句柄,要向这个窗口应用由nCmdShow指定的命令 
      nCmdShow  Long,为窗口指定可视性方面的一个命令。请用下述任何一个常数 
     
              SW_HIDE   隐藏窗口,活动状态给令一个窗口 
              SW_MINIMIZE 最小化窗口,活动状态给令一个窗口 
              SW_RESTORE 用原来的大小和位置显示一个窗口,同时令其进入活动状态 
              SW_SHOW 用当前的大小和位置显示一个窗口,同时令其进入活动状态 
              SW_SHOWMAXIMIZED 最大化窗口,并将其激活 
              SW_SHOWMINIMIZED 最小化窗口,并将其激活 
              SW_SHOWMINNOACTIVE 最小化一个窗口,同时不改变活动窗口 
              SW_SHOWNA 用当前的大小和位置显示一个窗口,不改变活动窗口 
              SW_SHOWNOACTIVATE 用最近的大小和位置显示一个窗口,同时不改变活动窗口 
              SW_SHOWNORMAL 与SW_RESTORE相同 
      

  4.   

    WM_SHOWWINDOW Notification--------------------------------------------------------------------------------The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.A window receives this message through its WindowProc function. 
    SyntaxWM_SHOWWINDOW    WPARAM wParam
        LPARAM lParam;
        
    ParameterswParam
    Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden. 
    lParam
    Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values. 
    SW_OTHERUNZOOM
    The window is being uncovered because a maximize window was restored or minimized.
    SW_OTHERZOOM
    The window is being covered by another window that has been maximized.
    SW_PARENTCLOSING
    The window's owner window is being minimized.
    SW_PARENTOPENING
    The window's owner window is being restored.
    Return ValueIf an application processes this message, it should return zero. 
    ResThe DefWindowProc function hides or shows the window, as specified by the message. If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function. The WM_SHOWWINDOW message is not sent under the following circumstances: 
    When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style. 
    When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function. 
      

  5.   

    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Const SW_SHOW = 5Private Sub Command1_Click()
        ShowWindow 控件句柄, SW_SHOW
    End Sub
      

  6.   

    ShowWindow hWnd, 0 '隐藏
    ShowWindow hWnd, 5 '显示
      

  7.   

    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Const SW_SHOW = 5
    Private Const SW_HIDE= 0  Private Sub Command1_Click()
        ShowWindow Form1.hWnd, SW_HIDE
      End Sub
    0 是隐藏,5是显示
      

  8.   

    显示/隐藏窗口应调用ShowWindowWM_SHOWWINDOW消息是:当用到ShowWindow改变窗口状态后,Windows系统用该消息通知你窗口状态已经改变了