How to remove the close button of the sub-form. The X in the upper right corner

Source: Internet
Author: User

How to remove the close button of the sub-form. The X in the upper right corner

Private declare function getsystemmenu lib "USER32" (byval hwnd as long, byval brevert as long) as long
Private declare function getmenuitemcount lib "USER32" (byval hmenu as long) as long
Private declare function removemenu lib "USER32" (byval hmenu as long, byval nposition as long, byval wflags as long) as long
Private declare function drawmenubar lib "USER32" (byval hwnd as long) as long
Private const mf_byposition = & H400 &
Private const mf_disabled = & H2 &

Public sub disablex (FRM as form)
Dim hmenu as long, ncount as long

'Obtain the menu handle of the Window System Menu
Hmenu = getsystemmenu (FRM. hwnd, 0)
'Obtain the number of menu items specified by hmenu.
Ncount = getmenuitemcount (hmenu)

'Remove the last menu item from the system menu (the last menu item is 'close ')
Call removemenu (hmenu, ncount-1, mf_disabled or mf_byposition)
'Redraw system menus
Drawmenubar frm. hwnd
End sub


Private sub commandementclick ()
End
End sub

Private sub form_load ()
Disablex me
End sub
Bytes -------------------------------------------------------------------------------------------------------------------------
In the sensitivity window of the window, set controlbox to false.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.