有的答干吗不答 form.controlbox为false

解决方案 »

  1.   

    文:你的contorbox写的也太离谱了
      

  2.   

    作者估计是想只屏蔽关闭按纽,不屏蔽最大化、最小化按纽
    好象有个API,忘了
      

  3.   

    BALLOONMAN:是的用API函数,但是我也没找到是什么函数,请你指教!
      

  4.   

    不一定要API的,可以用别的方法,我知道不过要先给分
      

  5.   

    在module中写Public Const MF_BYPOSITION = &H400
    Public Const MF_REMOVE = &H1000Public Declare Function DrawMenuBar Lib "user32" _
          (ByVal hwnd As Long) As Long
          
    Public Declare Function GetMenuItemCount Lib "user32" _
          (ByVal hMenu As Long) As Long
          
    Public Declare Function GetSystemMenu Lib "user32" _
          (ByVal hwnd As Long, _
          ByVal bRevert As Long) As Long
          
    Public Declare Function RemoveMenu Lib "user32" _
          (ByVal hMenu As Long, _
          ByVal nPosition As Long, _
          ByVal wFlags As Long) As LongSub main()
    Form1.Show 1
    End Sub在form的load里写这个Private Sub Form_Load()  Dim hMenu As Long
      Dim menuItemCount As Long  'Obtain the handle to the form's system menu
      hMenu = GetSystemMenu(Me.hwnd, 0)
      
      If hMenu Then
          
        'Obtain the number of items in the menu
          menuItemCount = GetMenuItemCount(hMenu)
        
        'Remove the system menu Close menu item.
        'The menu item is 0-based, so the last
        'item on the menu is menuItemCount - 1
          Call RemoveMenu(hMenu, menuItemCount - 1, _
                          MF_REMOVE Or MF_BYPOSITION)
      
        'Remove the system menu separator line
          Call RemoveMenu(hMenu, menuItemCount - 2, _
                          MF_REMOVE Or MF_BYPOSITION)
        
        'Force a redraw of the menu. This
        'refreshes the titlebar, dimming the X
          Call DrawMenuBar(Me.hwnd)  End If
      
    End Sub这个例子是前几天我在别的贴子里看到的,不是我写的
      

  6.   

    我靠,这么简单的东东用得着这么麻烦吗?
    看我的!Private Sub Form_Unload(Cancel As Integer)
        Cancel = -1
    End Sub
      

  7.   

    to updown:
    你那是屏蔽吗?用户会误以为你的程序出错了。
      

  8.   

    to limengchen:只是不让程序关掉而已但是用API函数对我们的要求有一点麻烦,我们的要求是:
    我们正在监控一辆车此时要求不能关闭程序,但是窗体上的关闭按钮不能屏蔽所以才有了上述问题当然用API函数也比较好给用户以明确的感官效果.希望你下次多多指教!有事可以给我发e_mail:
    [email protected]
      

  9.   

    我同意updown的看法,只不过要按当时的情况发送一个msgbox,不过我有防windows关机的办法!
    第一层:
    Private Sub Form_QueryUnLoad(.....(也就是参数,不用管))
    Cancel = True
    End Sub
    第二层,不行我再启动一次!:
    Private Sub Form_UnLoad(cancel)
    Shell(app.path + "\" & app.exename)
    End Sub
    木马必备的东西!