|
另类Msgbox(4) Call GetWindowRect(hFormhWnd, rcFrm) '使MessageBox居中 frmLeft = rcFrm.Left frmTop = rcFrm.Top frmWidth = rcFrm.Right - rcFrm.Left frmHeight = rcFrm.Bottom - rcFrm.Top dlgWidth = rc.Right - rc.Left dlgHeight = rc.Bottom - rc.Top scrWidth = Screen.Width \ Screen.TwipsPerPixelX scrHeight = Screen.Height \ Screen.TwipsPerPixelY newLeft = frmLeft + ((frmWidth - dlgWidth) \ 2) newTop = frmTop + ((frmHeight - dlgHeight) \ 2) '修改确定按钮的文字 Call SetDlgItemText(hwndMsgBox, IDOK, "这是确定按钮") 'Msgbox居中 Call MoveWindow(hwndMsgBox, newLeft, newTop, dlgWidth, dlgHeight, True) '卸载钩子 UnhookWindowsHookEx hHook End If CBTProc = False End Function 2·窗体中的代码: Form1中的----- Option Explicit Private Sub Command1_Click() '变量声明 Dim strTitle As String Dim strPrompt As String Dim lngStyle As Long
|