久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

VBA實(shí)用小程序04:在用戶(hù)窗體標(biāo)題欄添加最大化和最小化按鈕

 L羅樂(lè) 2018-02-03


有時(shí)候,,我們可能相在用戶(hù)窗體標(biāo)題欄添加最大化和最小化按鈕,以方便對(duì)用戶(hù)窗體的操控。下面是我找到的一段實(shí)現(xiàn)此功能的VBA代碼,,供大家需要時(shí)調(diào)用。

 

#If Win64 Then

    Private Declare PtrSafeFunction GetWindowLongPtr _

        Lib 'user32.dll'Alias 'GetWindowLongPtrA' ( _

        ByVal hwnd As LongPtr, _

        ByVal nIndex As Long) AsLongPtr

 

    Private Declare PtrSafeFunction SetWindowLongPtr _

        Lib 'user32.dll'Alias 'SetWindowLongPtrA' ( _

        ByVal hwnd As LongPtr, _

        ByVal nIndex As Long, _

        ByVal dwNewLong As LongPtr)As LongPtr

 

    Private Declare PtrSafeFunction FindWindowA _

        Lib 'user32.dll'( _

        ByVal lpClassName AsString, _

        ByVal lpWindowName AsString) As LongPtr

        

    Private Declare PtrSafeFunction DrawMenuBar _

        Lib 'user32.dll'( _

        ByVal hwnd As LongPtr) AsLong

#Else

    Private Declare FunctionGetWindowLongPtr _

        Lib 'user32.dll'Alias 'GetWindowLongA' ( _

        ByVal hwnd As Long, _

        ByVal nIndex As Long) AsLong

    

    Private Declare FunctionSetWindowLongPtr _

        Lib 'user32.dll'Alias 'SetWindowLongA' ( _

        ByVal hwnd As Long, _

        ByVal nIndex As Long, _

        ByVal dwNewLong As Long) As Long

 

    Private Declare FunctionFindWindowA _

        Lib 'user32.dll'( _

        ByVal lpClassName AsString, _

        ByVal lpWindowName AsString) As Long

        

    Private Declare FunctionDrawMenuBar _

        Lib 'user32.dll'( _

        ByVal hwnd As Long) As Long

#End If

 

Private Sub UserForm_Initialize()

    CreateMenu

End Sub

 

Private Sub CreateMenu()

    Const GWL_STYLE As Long = -16

    Const WS_SYSMENU As Long =&H80000

    Const WS_MINIMIZEBOX As Long =&H20000

    Const WS_MAXIMIZEBOX As Long =&H10000

    

    #If Win64 Then

        Dim lngFrmWndHdl As LongPtr

        Dim lngStyle As LongPtr

    #Else

        Dim lngFrmWndHdl As Long

        Dim lngStyle As Long

    #End If

    

    lngFrmWndHdl =FindWindowA(vbNullString, Me.Caption)

    

    lngStyle =GetWindowLongPtr(lngFrmWndHdl, GWL_STYLE)

    lngStyle = lngStyle OrWS_SYSMENU       'AddSystemMenu

    lngStyle = lngStyle OrWS_MINIMIZEBOX   'Add MinimizeBox

    lngStyle = lngStyle Or WS_MAXIMIZEBOX   'Add MaximizeBox

 

    SetWindowLongPtr lngFrmWndHdl,GWL_STYLE, lngStyle

    

    DrawMenuBar lngFrmWndHdl

End Sub

 

將上述代碼放置在用戶(hù)窗體代碼模塊中,,運(yùn)行后的效果如下圖所示:


    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀(guān)點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多