Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Is it possible to have an XL builtin Dialogue Box ( For Ex ' Format Cells ') displayed at the Bottom Right of the Screen instead of the Center ? Jaafar. Regards. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Jaafar :) it is possible, but .. there we go again.. only with api's michel pierron has published a few examples for msgbox positioning that you may want to adapt to your dialog situation. and ofcourse you;ll need to add some code to read the screensize,dialogsize and compute the new x,y of the dialog iso hardcoding it like in next example: michel is apt to replace the constants with numbers.. making it a bit harder to see what he does :) he SETS the hook with &H5, read that as WH_CBT (window hook computer based training) his WinProc reacts to lMsg=5 read that as HCBT_ACTIVATE the hooked window is being Activated.. he moves the window with &H15 read that as SWP_NOSIZE OR SWP_NOZORDER OR SWP_NOACTIVATE 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 -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam RAFAAJ2000 wrote : Hi all, Is it possible to have an XL builtin Dialogue Box ( For Ex ' Format Cells ') displayed at the Bottom Right of the Screen instead of the Center ? Jaafar. Regards. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks KeepItCool,
I'll have a look into this and get back to you. Jaafar. Regards. "keepITcool" wrote: Hi Jaafar :) it is possible, but .. there we go again.. only with api's michel pierron has published a few examples for msgbox positioning that you may want to adapt to your dialog situation. and ofcourse you;ll need to add some code to read the screensize,dialogsize and compute the new x,y of the dialog iso hardcoding it like in next example: michel is apt to replace the constants with numbers.. making it a bit harder to see what he does :) he SETS the hook with &H5, read that as WH_CBT (window hook computer based training) his WinProc reacts to lMsg=5 read that as HCBT_ACTIVATE the hooked window is being Activated.. he moves the window with &H15 read that as SWP_NOSIZE OR SWP_NOZORDER OR SWP_NOACTIVATE 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 -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam RAFAAJ2000 wrote : Hi all, Is it possible to have an XL builtin Dialogue Box ( For Ex ' Format Cells ') displayed at the Bottom Right of the Screen instead of the Center ? Jaafar. Regards. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hyperlink Destination Positioning On Screen | Excel Worksheet Functions | |||
print box opens in right screen of dual screen setup why | Excel Discussion (Misc queries) | |||
Positioning a cell at the top left of the screen | Excel Programming | |||
How to copy data from excel to power point screen by screen? | Excel Programming | |||
Positioning Data / Form dialogue box | Excel Programming |