在QueryUnload事件中,让Cancel=1不行吗?

解决方案 »

  1.   

    private sub form_unload()
       dim flag as integer   
       flag=msgbox("you sure quit???",64,"提示")
       if flag=1 then
          cancel=true
       else
          cancel=false
       end if
    end sub
      

  2.   

    我必须用API的,因为是由一个窗口向另一个窗口发送消息~
      

  3.   

    用API可以实现!!代码如下:
    Option Explicit
    Private Const WM_CLOSE As Long = &H10
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Sub Form_Click()
    SendMessage Me.hwnd, WM_CLOSE, 0, 0&
    End Sub看看现在实现了你要的功能了吗?see it
      

  4.   

    Private Sub Form_Unload(Cancel As Integer)
    ...
      Cancel = True
    ...
    End Sub
    不用api,和上面那位老兄一样,这样就可以了