form_unload 事件里把窗体隐藏到系统托盘去点击系统托盘时弹出菜单响应就行

解决方案 »

  1.   

    unload me "退出,就是从内存中清除了
    hide "就是隐藏
      

  2.   

    sub command_click()
      end
    sub end
      

  3.   

    定义一个模块级变量 bQuit As Boolean'当单击菜单中的 mnuExit 时Private Sub mnuExit_Click()
      bQuit = True
      Unload Me
    End SubPrivate Sub Form_Unload(Cancel As Integer)
      if bQuit Then
        ' 退出代码
      Else
        Cancel = 1
      EndIf
    End Sub
      

  4.   

    定义一个模块级变量 bQuit As Boolean'当单击菜单中的 mnuExit 时Private Sub mnuExit_Click()
      bQuit = True
      Unload Me
    End SubPrivate Sub Form_Unload(Cancel As Integer)
      if bQuit Then
        ' 退出代码
      Else
        Cancel = 1
        Me.Hide
      EndIf
    End Sub
      

  5.   

    尽量用Unload Me
    不要用End
      

  6.   

    YanJieBing(小严) 说对了可是我就是:' 退出代码写不好,又会返回到Private Sub mnuExit_Click()
      bQuit = True
      Unload Me
    End Sub这个函数中去,也就是退不出来了
      

  7.   

    我在模块在这样定义:Dim bQuit As Boolean在窗体中怎么会说bQuit没有定义呢
      

  8.   

    我在模块中这样定义:Dim bQuit As Boolean在窗体中怎么会说bQuit没有定义呢
      

  9.   

    To ysp128(世纪梦),用Public bQuit As Boolean
      

  10.   

    To ysp128(世纪梦),用Public bQuit As Boolean
      

  11.   

    To ysp128(世纪梦):用Public  bQuit As Boolean!
      

  12.   

    哦!谢谢但还是不会退出程序返回到下面函数中去了,无返回值的语句是什么呢?
    Private Sub mnuExit_Click()
      bQuit = True
      Unload Me
    End Sub
      

  13.   


    首先我要讲一下模块是一个 Module ,其中的变量要在窗体中引用时,必须定义为 Public 或 Global而模块级变量 则是指 在一个窗体、类、或模块中定义的变量用 Dim 定义后只能在本窗体、本类、本模块在使用,用 Public 定义后,可以在其他窗体、类、模块中使用如窗体 frmShow 中有一模块级变量 Public m As Interger 则引用为: frmShow.m如以 Dim m As Integer 形式定义,则在外部将不可显示
      

  14.   


    在退出代码中,可不能再调用 mnuExit_Click 过程了,否则就会进入死锁。
      

  15.   

    用unload不行吗?这个不能满足你的要求?
      

  16.   

    用QueryUnload事件来判断退出的模式,通过判断UnloadMode得值来判断程序的退出方式Private Sub Command1_Click()
    Unload Me
    End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If UnloadMode = 0 Then
        Cancel = 1
        'Me.Hide
    End If
    End Sub
      

  17.   

    定义一个模块级变量 bQuit As Boolean'当单击菜单中的 mnuExit 时Private Sub mnuExit_Click()
      bQuit = True
      Unload Me
    End SubPrivate Sub Form_Unload(Cancel As Integer)
      if bQuit Then
        ' 退出代码
      Else
        Cancel = 1
        Me.Hide
      EndIf
    End Sub