##CocoLiu 一年前的個(gè)人編寫(xiě),希望大家喜歡。##
效果圖如上:^-^
Option Explicit '************************************************************* '*模塊:mMsgBoxEx '*功能:把對(duì)話框的字體改變顏色,背景改變圖片。 '*調(diào)用:MsgBoxEx("改變背景對(duì)話框!" , vbOKOnly , "提示", , , vbCyan) '************************************************************* Private Type CWPSTRUCT End Type Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long 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 CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long Private Declare Function CreatePatternBrush Lib "gdi32" (ByVal hBitmap As Long) As Long '透明處理 Public Const TRANSPARENT = 1 Private Const WH_CALLWNDPROC = 4 Private Const GWL_WNDPROC = (-4) Private Const WM_CTLCOLORBTN = &H135 Private Const WM_DESTROY = &H2 Private Const WM_SETTEXT = &HC Private Const WM_CREATE = &H1 ' System Color Constants Private Const COLOR_BTNFACE = 15 Private Const COLOR_BTNTEXT = 18 ' Windows Messages Private Const WM_CTLCOLORSTATIC = &H138 Private Const WM_CTLCOLORDLG = &H136 Private lHook As Long Private lPrevWnd As Long Private lForecolor As Long Public Function SubMsgBox(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long End Function Private Function HookWindow(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long |