728x90









GetCursorPos API는 마우스의 자표값을 알려주는 API이다.

Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Private Type POINTAPI
    x As Long
    y As Long
End Type

Private Sub Timer1_Timer() 'Timer1.Interval = 1
Static MP As POINTAPI
GetCursorPos MP
    Form1.Cls
    Print MP.x
    Print MP.y
End Sub

728x90

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long '선언하시는곳은 맨위에 적어주세요. 모듈에 해주실꺼면 Private -> Public 고쳐주세요

사용방법 :
FindWindow(lpClassName, lpWindowName)
이런식으로 사용합니다.

예시 -
Debug.Print FindWindow("BuddyBuddy", "버디버디") '디버그창에다가 핸들값 출력
MsgBox FindWindow("BuddyBuddy", "버디버디") '메세지창으로 핸들값 출력

lpClassName : 클레스네임
pWindowName : 윈도우에 표시되는 이름

클레스네임이나 윈도우 네임을 모를때 쓰는 함수 : vbNullString

사용법 :  

FindWindow("vbNullString", lpWindowName)
FindWindow(lpClassName, "vbNullString")

+ Recent posts