728x90











GetPixel API는 마우스포인터에 위치해 있는 픽셀을 가져오는 API입니다.

Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Long) As Long
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 Hex(GetPixel(GetWindowDC(GetDesktopWindow), MP.x, MP.y))
End Sub

예제파일없음
728x90

















GetWindowRect API 바탕화면의 해상도를 구할수있는 API이다.

Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Sub Form_Load()
Dim De As RECT
GetWindowRect GetDesktopWindow, De
MsgBox De.Right & " x " & De.Bottom
End Sub

예제파일없음
728x90












GetDC API, GetWindowDC API 두개의 API모두 DC값을 구할수 있는 API이다.

Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Long) As Long

Private Sub Form_Load()
MsgBox GetDC(GetDesktopWindow)
MsgBox GetWindowDC(GetDesktopWindow)
End Sub

예제파일없음
728x90

 

 

 

 


GetDesktopWindow API는 데스크탑 핸들값을 구하는 API이다.

Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long

Private Sub Form_Load()
MsgBox GetDesktopWindow ' 메시지창으로 데스크탑 핸들값을 띄움
End Sub


예제파일없음
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

VB 유마일 프리셋 쉽게 수정하기 Upgrade


사용법은 일단 XP이하 OS인지 Vista 인지 선택하시고 (프리셋경로가 다르기때문에) 

목록에서 수정할 프리셋을 선택하시면

옵션이 불러와집니다. 

여기서 잠깐!

옵션에 존제 하지 않는 비트레이트, 프레임, 화면크기 는 불러오지 못합니다.

그러기떄문에 사용자께서 직접 입력해주세요. 

옵션을 수정한뒤 맨밑에 있는 저장버튼을 클릭해주세요. 

 vb6ko.dll 오류가 나면 첨부된 파일을 설치해주세요.

728x90
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")

728x90

Len() 함수는 모든 문자열을 1바이트로 인식합니다

예 - Len("ABC가나다")
결과 : 6


그와 틀리게

LenB() 함수는 영문은 1바이트 문자는 2바이트로 인식합니다.

예 - LenB(StrConv("ABC가나다",vbFromUnicode))
결과 : 9


그게 Len() 과 LenB()의 차이입니다.

728x90
Unload 폼이름  예 ) Unload Form1        'Unload me 를 써줘도 되지만 폼이름을 써주는것이 더 좋음.

폼이름.Hide ' 폼을 숨긴다.

폼이름.Show ' 폼을 연다.



Me를 써주는건 좋지 않은것같구요.

정확한 명칭을 써주는것이 더욱 좋습니다.

+ Recent posts