ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message Box position (https://www.excelbanter.com/excel-programming/313775-message-box-position.html)

John Keturi

Message Box position
 
My MsgBox covers some data I want to see, is there a way to define a
position for it? Thanks



Michel Pierron

Message Box position
 
Hi John;
Private Declare Function UnhookWindowsHookEx Lib "user32" _
(ByVal hHook As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () 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 SetWindowPos Lib "user32" (ByVal hwnd As Long _
, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long _
, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private lgHook As Long

Sub Positionned_MsgBox()
lgHook = SetWindowsHookEx(&H5, AddressOf WinProc, 0, GetCurrentThreadId)
MsgBox "Special msgbox (Left = 100 / Top = 100) !", 64
End Sub

Private Function WinProc(ByVal lMsg As Long, ByVal wParam As Long) As Long
If lMsg = 5 Then
SetWindowPos wParam, 0, 100, 100, 0, 0, &H15
UnhookWindowsHookEx lgHook
End If
WinProc = False
End Function

Regards,
MP

"John Keturi" a écrit dans le message de
news:1bhcd.44666$hj.43803@fed1read07...
My MsgBox covers some data I want to see, is there a way to define a
position for it? Thanks






All times are GMT +1. The time now is 08:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com