Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
focusing mouse pointer to the specific button in a userform tom taol Excel Programming 3 December 10th 07 01:55 PM
How can you close a window with the back button in excel Holly Williams Excel Discussion (Misc queries) 0 September 20th 05 01:57 PM
Disable the Close Window button of the worksheet yangyh[_7_] Excel Programming 0 September 14th 05 05:04 AM
moving mouse highlights cells without touching left mouse button bremboy Excel Discussion (Misc queries) 2 January 27th 05 06:19 PM
How do I disable the Margins button in Print Preview Window John[_35_] Excel Programming 0 July 23rd 03 03:43 AM


All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"