VB編程:去掉窗體的關(guān)閉按鈕

字號(hào):

private declare function getsystemmenu lib 'user32' (byval hwnd as long, byval brevert 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 declare function getmenuitemcount lib 'user32' (byval hmenu as long) as long
    private const mf_byposition = &h400&
    private const mf_disabled = &h2&
    private sub form_load()
    call disablex(me)
    end sub
    private sub disablex(frm as form)
    dim hmenu as long, ncount as long
    hmenu = getsystemmenu(frm.hwnd, 0)
    ncount = getmenuitemcount(hmenu)
    call removemenu(hmenu, ncount - 1, mf_disabled or mf_byposition)
    drawmenubar frm.hwnd
    end sub