ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¥H¤U«ü¥O¬O¤°»ò·N«ä

¥H¤U«ü¥O¬O¤°»ò·N«ä

½Ð±Ð¤j¤j¡A¥H¤UVBA¡A¨C¦æ«ü¥O¬O¤°»ò·N«ä¡AÁÂÁÂ!

'**Win32 API Declarations
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal IpClassName As String, ByVal IpWindowName As String) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, IpRect As RECT) As Long

'**Win32 API User Defined Types
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Sub test()
Dim Rec As RECT
'Get Left, Right, Top and Bottom of Form1
GetWindowRect GetWindowHandle, Rec
'Set Cursor position on X
SetCursorPos Rec.Right - 600, Rec.Top + 400
End Sub

Private Function GetWindowHandle() As Long
Const CLASSNAME_M**cel="XLMAIN"
'Gets the Apps window handle, since you can't use App.hInstance in VBA (VB Only)
GetWindowHandle = FindWindow(CLASSNAME_M**cel, vbNullString)
End Function

SUB TEST¥H¤Wªº¬OAPI©w¸q,¥Î¨Ó©I¥sWINDOW¨t²Îªº"¤pµ{§Ç"
³o¸Ì¦³3­Ó"¤pµ{§Ç":FindWindow,SetCursorPos,GetWindowRect

Private Sub test()
Dim Rec As RECT   ³o¥y§A¥i¥H·í¬O¦s§¤¼ÐªºÅܶqREC
GetWindowRect GetWindowHandle, Rec   §âEXCELªº§¤¼Ð©ñ¨ìREC
SetCursorPos Rec.Right - 600, Rec.Top + 400 §â¦Ñ¹«©ñ¨ìEXCEL¥k¤W¨¤¦V¥ª600ÂI¦ì©M¤W¤è¹ï¤U400ÂI¦ì
End Sub

GetWindowHandle:
XLMAIN¬OEXCELªº"¨t²Î¦WºÙ" FINDWINDOW ¥Î¨Ó§ä¥XEXCELªº"ID:  (§YHANDLE)
¥Î¨Ó§@¤é«á«ü©wª©­±°µ¾Þ§@,¦pTEST¤UªºSETCURSORPOS

GetWindowHandle¥i¼g¦¨
Private Function GetWindowHandle() As Long
GetWindowHandle = FindWindow("XLMAIN", vbNullString)
End Function
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

SUB TEST¥H¤Wªº¬OAPI©w¸q,¥Î¨Ó©I¥sWINDOW¨t²Îªº"¤pµ{§Ç"
³o¸Ì¦³3­Ó"¤pµ{§Ç":FindWindow,SetCursorPos,GetW ...
kimbal µoªí©ó 2010-11-5 00:06



    ÁÂÁª©¤j¸Ô²Ó»¡©ú!²z¸Ñ¤¤...

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD