Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
mouse focusing in close button in preview window
i have a button in the sheet.
when i press the button, preview run. i want to focusing with mouse pointer to close button in preview window. Private Declare Function SetTimer _ Lib "user32" ( _ ByVal hwnd As Long, _ ByVal nIDEvent As Long, _ ByVal uElapse As Long, _ ByVal lpTimerFunc As Long) _ As Long Private Declare Function KillTimer _ Lib "user32" ( _ ByVal hwnd As Long, _ ByVal nIDEvent As Long) _ As Long Private Declare Function GetActiveWindow _ Lib "user32" () _ As Long Private Declare Function FindWindowEx _ Lib "user32" _ Alias "FindWindowExA" ( _ ByVal hWnd1 As Long, _ ByVal hWnd2 As Long, _ ByVal lpsz1 As String, _ ByVal lpsz2 As String) _ As Long Private Declare Function SetCursorPos Lib "user32" _ (ByVal x As Long, ByVal y As Long) As Long Private Declare Function ClientToScreen Lib "user32" _ (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Type POINTAPI x As Long y As Long End Type Type Rect x1 As Long y1 As Long x2 As Long y2 As Long End Type Private Const GW_CHILD = 5 Private rt As Rect Private pt As POINTAPI Private Declare Function GetWindow Lib "user32" ( _ ByVal hwnd As Long, ByVal uCmd As Long) As Long Public Function TimMsg3( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal nEvent As Long, _ ByVal nSecs As Long) As Long KillTimer 0, nEvent hdlwndAct = GetActiveWindow() prev = GetWindow(hdlwndAct, GW_CHILD) hBtn = FindWindowEx(prev, 0&, "Button", "´Ý±(&C)") GetClientRect hBtn, rt pt.x = rt.x1 pt.y = rt.y1 ClientToScreen hBtn, pt SetCursorPos pt.x + 20, pt.y + 10 End Function Sub prvAndFocusColseBtn() SetTimer 0, 0, 100, AddressOf TimMsg3 ActiveSheet.PrintPreview End Sub *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
focusing mouse pointer to the specific button in a userform | Excel Programming | |||
How can you close a window with the back button in excel | Excel Discussion (Misc queries) | |||
Disable the Close Window button of the worksheet | Excel Programming | |||
moving mouse highlights cells without touching left mouse button | Excel Discussion (Misc queries) | |||
How do I disable the Margins button in Print Preview Window | Excel Programming |