请问如何用鼠标点击就能实现隐藏\关闭窗体我编了一个软件,启用软件前显示一个欢迎画面(frmSplash),5秒钟后自动隐藏,然后显示主程序画面frmMain,,示例如下。Private Sub Form_Paint() '启用此欢迎画面
  Sleep 5000 '延迟五秒
  frmMain.Show '主窗体显示
  frmSplash.Hide  '本窗体隐藏
End Sub我搜了一下此网,网上给出过如下程序,但是怎样用于我的小程序内呢?
'   想用鼠标单击退出就这样   
  Option   Explicit   
  Private   Declare   Function   SetCapture   Lib   "user32"   (ByVal   hwnd   As   Long)   As   Long   
    
  Private   Sub   Form_Load()   
  SetCapture   Me.hwnd   
  End   Sub   
    
  Private   Sub   Form_MouseDown(Button   As   Integer,   Shift   As   Integer,   X   As   Single,   Y   As   Single)   
  Unload   Me   
  End   Sub   
  
请给出代码,感谢!立即加分!

解决方案 »

  1.   

      Option  Explicit  
      Private  Declare  Function  SetCapture  Lib  "user32"  (ByVal  hwnd  As  Long)  As  Long  
        
      Private  Sub  Form_Load()  
      SetCapture  Me.hwnd  
      End  Sub  
        
      Private  Sub  Form_MouseDown(Button  As  Integer,  Shift  As  Integer,  X  As  Single,  Y  As  Single)  
      frmMain.Show '主窗体显示 
      frmSplash.Hide  '本窗体隐藏 
      End  Sub  
      
    Private Sub Form_Paint() '启用此欢迎画面 
      Sleep 5000 '延迟五秒 
      frmMain.Show '主窗体显示 
      frmSplash.Hide  '本窗体隐藏 
    End Sub