用 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