标题:用 API 禁止关闭窗口禁止最小化后怎么解除
只看楼主
Ez330阿牛
Rank: 2
等 级:论坛游民
帖 子:42
专家分:14
注 册:2014-3-5
结帖率:11.11%
 问题点数:0 回复次数:0 
用 API 禁止关闭窗口禁止最小化后怎么解除
如题,想不明白来来问的,求指点
程序代码:
Public Function DisableClose(ByVal hwnd, Optional ByVal MDIChild As Boolean)
    Dim hSysMenu As Long
    Dim nCnt As Long
    Dim cID As Long
    hSysMenu = GetSystemMenu(hwnd, False)
    If hSysMenu = 0 Then Exit Function
    nCnt = GetMenuItemCount(hSysMenu)
    If MDIChild Then
        cID = 3
    Else
        cID = 1
    End If
    If nCnt Then
        DisableClose = RemoveMenu(hSysMenu, nCnt - cID, MF_BYPOSITION Or MF_REMOVE)
        DisableClose = RemoveMenu(hSysMenu, nCnt - cID - 1, MF_BYPOSITION Or MF_REMOVE)
        nCnt = GetMenuItemCount(hSysMenu)
        DisableClose = DeleteMenu(hSysMenu, nCnt - 1, MF_BYPOSITION)
        nCnt = GetMenuItemCount(hSysMenu)
        DisableClose = DeleteMenu(hSysMenu, nCnt - 1, MF_BYPOSITION)
    End If
End Function
2014-05-19 21:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-431794-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.299206 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved