오토핫키 커뮤니티

질문
2019.02.22 18:06

이 소스 내용이 뭔가요?

조회 수 2503 추천 0 댓글 0

인터넷에서 클래스DD관련해서 찾다가 뭔가 대단해보이는 소스를 찾았는데

이거 그냥 DD호출하는 소스가 맞나요?

이거 글만 길게 썼다뿐이지, include, class_dd.ahk 이거랑 똑같은거죠?


class DD extends DD_Helper
{
        ; Simulate mouse button press
        ; param:   1 = LButton Down,    2 = LButton Up
        ;          4 = RButton Down,    8 = RButton Up
        ;         16 = MButton Down,   32 = MButton Up
        ;         64 = Button 4 Down, 128 = Button 4 Up
        ;        256 = Button 5 Down, 512 = Button 5 Up
        btn(param) {
                return DllCall(this.dllFile "\DD_btn", "int", param)
        }
    
        ; Simulate mouse move
        mov(x, y) {
                return DllCall(this.dllFile "\DD_mov", "int", x, "int", y)
        }
    
        ; Simulate mouse move (relatively)
        movR(dx, dy) {
                return DllCall(this.dllFile "\DD_movR", "int", dx, "int", dy)
        }
    
        ; Simulate mouse wheel
        ; param: 1=upward 2=downward
        whl(param) {
                return DllCall(this.dllFile "\DD_whl", "int", param)
        }
    
        ; Simulate keyboard
        ; param1: DD code
        ; param2: 1=Down 2=Up
        key(param1, param2) {
                return DllCall(this.dllFile "\DD_key", "int", param1, "int", param2)
        }
    
        ; VKCode to DD code
        todc(VKCode) {
                return DllCall(this.dllFile "\DD_todc", "int", VKCode)
        }
    
        ; Send string
        str(string) {
                return DllCall(this.dllFile "\DD_str", "astr", string)
        }
    
        ; Get hwnd of active window
        GetActiveWindow() {
                ; return DllCall(this.dllFile "\DD_GetActiveWindow", "ptr") ; seems not working
                return WinExist("A")
        }
    
        MouseMove(hwnd, x, y) {
                return DllCall(this.dllFile "\DD_MouseMove", "ptr", hwnd, "int", x, "int", y)
        }
    
        ; The picture is saved to "C:\DD Snap\" folder
        SnapPic(hwnd, x, y, w, h) {
                return DllCall(this.dllFile "\DD_SnapPic", "ptr", hwnd, "int", x, "int", y, "int", w, "int", h)
        }
    
        PickColor(hwnd, x, y, mode=2) {
                return DllCall(this.dllFile "\DD_PickColor", "ptr", hwnd, "int", x, "int", y, "int", mode)
        }
}

class DD_Helper
{
        static _ := DD_Helper.InitClass()
    
        InitClass() {
                if !A_IsAdmin {
                        Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
                        ExitApp
                }
                this.LoadDll()
        }
    
        LoadDll() {
                if A_Is64bitOS {
                        dllFile := (A_PtrSize=8) ? "DD\64\ddx64.64.dll" : "DD\64\ddx64.32.dll"
                } else {
                        dllFile := "DD\32\ddx32.dll"
                }
        
                if !this.hModule := DllCall("LoadLibrary", "Str", dllFile, "Ptr") {
                        if !FileExist(dllFile) {
                                throw, dllFile " not found."
                        }
                        throw, "LoadLibrary failed. DllFile is " dllFile
                }
                this.dllFile := dllFile
        }
    
        UnloadDll() {
                DllCall("FreeLibrary", "Ptr", this.hModule)
        }
        
        ; Example: _btn("RButtonDown")
        _btn(sNick, x:="", y:="") {
                static oNick := { LButtonDown: 1, LButtonUp: 2
                                , RButtonDown: 4, RButtonUp: 8
                                , MButtonDown: 16, MButtonUp: 32
                                , 4ButtonDown: 64, 4ButtonUp: 128
                                , 5ButtonDown: 256, 5ButtonUp: 512 }
                if !( n := oNick[sNick] ) {
                        throw, sNick " is not a valid nick."
                }
                if (x != "") {
                        this.mov(x, y)
                }
                this.btn(n)
        }
    
        ; Example: _btn_press("RButton")
        _btn_press(sNick, x:="", y:="", nCount:=1) {
                static oNick := { LButton: {Down: 1, Up: 2}
                                , RButton: {Down: 4, Up: 8}
                                , MButton: {Down: 16, Up: 32}
                                , 4Button: {Down: 64, Up: 128}
                                , 5Button: {Down: 256, Up: 512} }
                if !( o := oNick[sNick] ) {
                        throw, sNick " is not a valid nick."
                }
                if (x != "") {
                        this.mov(x, y)
                }
                Loop, % nCount {
                        this.btn( o.Down )
                        this.btn( o.Up )
                        Sleep, 5
                }
        }
    
        ; Example: _key("F11", "Down")
        ;          _key("F11", "Up")
        _key(sKey, sflag) {
                ddCode := this.todc( GetKeyVK(sKey) )
                this.key(ddCode, (sflag="Up") ? 2 : 1 )
        }
    
        ; Example: _key_press("F11")
        ;          _key_press("Ctrl", "A")
        _key_press(sKey*) {
                arr_ddCode := []
        
                for i, k in sKey {
                        arr_ddCode[i] := this.todc( GetKeyVK(k) )
                        this.key(arr_ddCode[i], 1) ; Down
                }
                for i, ddCode in arr_ddCode {
                        this.key(ddCode, 2) ; Up
                }
        }
    
        _key_pressEx(sKey, nCount := 1) {
                ddCode := this.todc( GetKeyVK(sKey) )
        
                Loop, % nCount {
                        this.key(ddCode, 1) ; Down
                        this.key(ddCode, 2) ; Up
                }
        }
    
        ; Example: _whl("down")
        ;          _whl("up")
        _whl(sParam) {
                this.whl( (sParam="Up") ? 1 : 2 )
        }
}



List of Articles
분류 제목 글쓴이 최근변경 추천
질문 [질문] ToolTip 잘 모르겠는데요. 4 마토깽 2015.07.20 0/0
질문 [질문] Settimer 사용시 일시정지 기능 5 마토깽 2015.11.19 0/0
질문 [질문] Gui Creator, SaveFile(.xml) Load 실패 1 마토깽 2015.10.29 0/0
질문 [입문자]랜덤키입력+랜덤딜레이 질문이요 1 라디에스 2017.11.18 0/0
질문 [입문자] 녹스 비활성화 랜덤좌표 클릭 질문이용!! 1 라디에스 2017.11.18 0/0
질문 [오토핫키] 여러개의 사진을 이미지 서칭하는 방법에 ... 5 동방밀사 2015.02.05 0/0
질문 [오토핫키 질문] 이미지서치 11 겜도리 2014.10.28 0/0
질문 [오토핫키 1일차] 재미있네요! 막힌부분 질문! 6 쿠우우우우 2018.04.28 0/0
질문 [오랜만에 접속했습니다. 오토핫키 배워보렵니다.] 클라이머 2020.02.20 0/0
질문 [세나]스킬에 우선권을 줘서 스킬이 예약되있으면 취소... 2 genie7 2015.11.02 0/0
질문 [세나] 매크로 만드는 중인데 좌표 값을 모르겟네요 6 genie7 2015.08.15 0/0
질문 [사무업무]Postmessage혹은 Controlsend로 창2개컨트롤... 2 법돌 2015.06.04 0/0
질문 [별이되어라]오토핫키 잘 아시는분 있으시면 도와주세요 16 천조국 2015.02.05 0/0
질문 [밀크탭게임 관련]어떤 방법을 동원해도 이건 안되네요... 20 로맨티스트 2015.07.11 0/0
질문 [명령어]오토핫키 명령어로 부팅시 오토핫키 실행하게 ... 생존자8 2017.07.04 0/0
질문 [레이븐]setimer 라벨에 gosub 이나 goto 명령어 쓰면 ... 15 T7GG 2015.08.30 0/0
질문 [Gui] 이미지가 포함된 편집가능한 테이블 제작 26 Hangoon 2015.03.26 1/0
질문 xe홈페이지 로그인 인증방법 문의 24 우리형 2016.02.16 1/0
질문 x,y축의 직선이 마우스 따라다니게 할수 있나요?? 맛초킹 2017.02.13 0/0
질문 X Trap은 뮤텍스로 우회 못하나요? gab 2018.02.03 0/0
Board Pagination Prev 1 ... 134135136137138139140141142 ... 173 Next
/ 173

전체 최신 인기글

전체 주간 인기글