Đáp:
Bạn có thể ẩn nút close bằng đoạn code sau:
Code:
Private Const GWL_EXSTYLE = (-20) Private Const GWL_STYLE = (-16) Private Const WS_MAXIMIZEBOX = &H10000 Private Const WS_MINIMIZEBOX = &H20000 Private Const WS_SYSMENU = &H80000 Private Const HWND_TOP = 0 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const SWP_FRAMECHANGED = &H20 Private Const SWP_DRAWFRAME = SWP_FRAMECHANGED Private Declare Function SetWindowLong Lib "user32" _ Alias "SetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long, ByVal dwNewLong As Long) _ As Long Private Declare Function GetWindowLong Lib "user32" _ Alias "GetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long) As Long Private Declare Function SetWindowPos Lib "user32" _ (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _ ByVal x As Long, ByVal y As Long, ByVal cx As Long, _ ByVal cy As Long, ByVal wFlags As Long) As Long Sub HideAccessCloseButton() Dim lngStyle As Long lngStyle = GetWindowLong(hWndAccessApp, GWL_STYLE) lngStyle = lngStyle And Not WS_SYSMENU Call SetWindowLong(hWndAccessApp, GWL_STYLE, lngStyle) Call SetWindowPos(hWndAccessApp, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_DRAWFRAME) End Sub
Bây giờ trong form Admin của bạn, bạn có thể tạo 1 nút nhấn và gọi hàm HideAccessCloseButton để ẩn nút close. Nếu vẫn chưa được. Hãy đ1ong Access và mở lại.
Xem các hình
Access trước khi ẩn nút
Access sau khi ẩn nút
____________________________________________________________________________________
Thảo luận thêm tại: http://thuthuataccess.co.cc/forum
a chi em cu the hon di chep doan code do vao dau
Trả lờiXóa