오토핫키 커뮤니티

조회 수 247 추천 0 댓글 3
OnMessage(0x100, "GUI_KeyDown", 2) ;// This when the GUI is initialized.
이렇게 선언하고
GUI_KeyDown(wParam, lParam, nMsg, hWnd)
{
pipa := ComObjQuery(WEB, "{00000117-0000-0000-C000-000000000046}")
VarSetCapacity(kMsg, 48), NumPut(A_GuiY, NumPut(A_GuiX
, NumPut(A_EventInfo, NumPut(lParam, NumPut(wParam
, NumPut(nMsg, NumPut(hWnd, kMsg)))), "uint"), "int"), "int")
Loop 2
{
r := DllCall(NumGet(NumGet(1*pipa)+5*A_PtrSize), "ptr", pipa, "ptr", &kMsg)
}
;// Loop to work around an odd tabbing issue (it's as if there
;// is a non-existent element at the end of the tab order).[/color]
until wParam != 9 || WEB.Document.activeElement != ""
ObjRelease(pipa)
if r = 0 ;// S_OK: the message was translated to an accelerator.
return 0
}
아래의 함수를 추가해놨습니다. 근데 GUI에서 Send,{Enter} 작업이 필요한데 Enter 작업이 먹히질않네요...
어떻게 써야 Enter 이 먹힐까요? (ActiveX 에 먹혀야합니다.)

  • profile
    예지력1 2015.10.19 21:20

    블로그에도 문의해주셨는데 코드가 길어서 여기에 답변해드릴게요

    검색창에 아무렇게나 치고 F1 눌러보세요


    #NoEnv
    #NoTrayIcon
    #SingleInstance Off
    #KeyHistory 0
    ListLines Off
    SetBatchLines, -1
    Init := new Browser()
    return

    F1::
    Init.OnMessage("13", "1835009", "256", Init.hWnd)
    return

    class Browser
    {
     static URL := "https://duckduckgo.com"
     
     __New()
     {
      global
      Gui, New, +Resize +hwndhMain
      this.hMain := hMain
      
      Gui, Add, ActiveX, x0 y0 w500 h500 hwndhEmbed vWB, Shell.Explorer
      this.hEmbed := hEmbed
      WB.silent := true, WB.Navigate(this.URL)
      
      this.Bound := []
      this.Bound.OnMessage := this.OnMessage.Bind(this)
      
      WinEvents.Register(this.hMain, this)
      for each, Msg in [0x100, 0x201, 0x202, 0x204]
       OnMessage(Msg, this.Bound.OnMessage)
      
      Gui,Show, % " w" A_ScreenWidth*0.7 " h" A_ScreenHeight*0.7 , 브라우저
     }

     GuiSize()
     {
      DllCall("MoveWindow", "Ptr", this.hEmbed, "Int", 0, "Int", 0, "Int", A_GuiWidth, "Int", A_GuiHeight, "Int", 1)
     }
     
     GuiClose()
     {
      for each, Msg in [0x100, 0x201, 0x202, 0x204]
       OnMessage(Msg, this.Bound.OnMessage, 0)
      
      this.Delete("Bound"), WinEvents.Unregister(this.hMain)
      Gui, Destroy
      ExitApp
     }
     
     OnMessage(wParam, lParam, Msg, hWnd)
     {
      static fields := "hWnd,Msg,wParam,lParam,A_EventInfo,A_GuiX,A_GuiY"
      global WB
      
      this.hWnd := hWnd
      if (Msg == 0x100)
      {
        pipa := ComObjQuery(WB.document, "{00000117-0000-0000-C000-000000000046}")
        VarSetCapacity(Msgs, 48)
        Loop Parse, fields, `,             ;`
        NumPut(%A_LoopField%, Msgs, (A_Index-1)*A_PtrSize)
        TranslateAccelerator := NumGet(NumGet(1*pipa)+5*A_PtrSize)
        Loop 2
         r := DllCall(TranslateAccelerator, "Ptr",pipa, "Ptr",&Msgs)
        until wParam != 9 || WB.document.activeElement != ""
        ObjRelease(pipa)
        if r = 0
         return 0
      }
     }
    }

    class WinEvents
    {
     static Table := {}
     
     Register(hWnd, Class, Prefix="Gui")
     {
      Gui, +LabelWinEvents.
      this.Table[hWnd] := {Class: Class, Prefix: Prefix}
     }
     
     Unregister(hWnd)
     {
      this.Table.Delete(hWnd)
     }
     
     Dispatch(hWnd, Type)
     {
      Info := this.Table[hWnd]
      
      return Info.Class[Info.Prefix . Type].Call(Info.Class)
     }
     
     Close()
     {
      return WinEvents.Dispatch(this, "Close")
     }
     
     Size()
     {
      return WinEvents.Dispatch(this, "Size")
     }
    }

  • _Crash 2015.10.20 00:07

    으 저는 Class 를 나눠서 작업하질않아서 햇갈리네요.

    #SingleInstance,force
    Gui, Color, White
    Gui, Font, S18
    Gui, Add, ActiveX,x0 y0 w1000 h650 vWEB HScroll ,www.naver.com
    Gui, Add, Text, x0 y655 w1000 h30 cBlue Center vShowText,F1 시작
    Gui, Show, w1000 h680, 타이틀
    Global WEB
    return

    F1::
    OnMessage("13", "1835009", "256", hwnd)
    return

    OnMessage(wParam, lParam, Msg, hwnd)
    {
    static fields := "hWnd,Msg,wParam,lParam,A_EventInfo,A_GuiX,A_GuiY"
    global WEB

    hWnd := hwnd
    if (Msg == 0x100)
    {
    pipa := ComObjQuery(WEB.document, "{00000117-0000-0000-C000-000000000046}")
    VarSetCapacity(Msgs, 48)
    Loop Parse, fields, `, ;`
    NumPut(%A_LoopField%, Msgs, (A_Index-1)*A_PtrSize)
    TranslateAccelerator := NumGet(NumGet(1*pipa)+5*A_PtrSize)
    Loop 2
    r := DllCall(TranslateAccelerator, "Ptr",pipa, "Ptr",&Msgs)
    until wParam != 9 || WEB.document.activeElement != ""
    ObjRelease(pipa)
    if r = 0
    return 0
    }
    }

    어디가 틀렸나요? hwnd 값을넘겨줘야 하는거같은데 activex hwnd 값을만들어서 넘겨줘도 반응이없네요...


    추가로 이렇게만들면 F1눌렀을때 다른창에는 아무런영향이없는거 맞나요? (비활성입력랑 같은셈인가요?)


    저는 비활성엔터가필요합니다. 

  • profile
    예지력1 2015.10.20 01:06
    클래스로 안짜시면 OnMessage를 함수로 만들면 안됩니다, 저건 오브젝트로 만들때의 OnMessage 내장함수에요
    함수밖에서 생성하는 변수는 모두 Global 변수에요, 잘못 이해하고 계신거 같네요! (Global WEB 필요없음)
    그리고 웹을 비활성으로 컨트롤하시려면 이런거보다 DOM을 사용하는게 훨씬 쉽고 정확해요

    #SingleInstance,force
    OnMessage(0x0100, "WM_KeyPress"), OnMessage(0x0101, "WM_KeyPress")
    Gui, Color, White
    Gui, Font, S18
    Gui, Add, ActiveX,x0 y0 w1000 h650 vWEB HScroll ,www.naver.com
    Gui, Add, Text, x0 y655 w1000 h30 cBlue Center vShowText,F1 시작
    IOleInPlaceActiveObject_Interface:="{00000117-0000-0000-C000-000000000046}"
    pipa := ComObjQuery(WEB, IOleInPlaceActiveObject_Interface )
    TranslateAccelerator := NumGet(NumGet(pipa+0 ) + 5*A_PtrSize )
    Gui, Show, w1000 h680, 타이틀
    return

    F1::
    ControlGet, hShell, Hwnd,, Internet Explorer_Server1, A
    WM_KeyPress("13", "1835009", "256", hShell)
    return

    WM_KeyPress(wParam, lParam, nMsg, hWnd ) {

    Global WEB, pipa, TranslateAccelerator
    Static Vars := "hWnd | nMsg | wParam | lParam | A_EventInfo | A_GuiX | A_GuiY"

    VarSetCapacity( MSG, 48, 0 )
    Loop, Parse, Vars, |, %A_Space%
    NumPut( %A_LoopField%, MSG, ( A_Index-1 ) * A_PtrSize )

    Loop 2
    r := DllCall( TranslateAccelerator, UInt,pipa, UInt,&MSG )
    Until wParam != 9 || WEB.document.activeElement != ""

    IfEqual, R, 0, Return, 0
    }

List of Articles
분류 제목 글쓴이 최근변경 추천
질문 이미지서치 픽셀서치를 여러개 할때 3 위험인물1 2015.10.11 0/0
질문 이에러좀 봐주세요 ... 9 제발등업좀2 2015.10.12 0/0
질문 오토핫키 여러사진 이미지 서치 질문 3 aces 2015.10.12 0/0
질문 루프중인 스레드 중지 4 엑시노트 2015.10.12 0/0
질문 님들 윈도우10에서 이미지서치나 픽셀서치 겟픽셀 어떤... 6 MC하얀늑대 2015.10.21 0/0
자유 GUI만들기 너무 귀찮네요. 15 외치기 2015.10.21 0/0
질문 gdip 이미지서치 질문입니다. 2 비빔면 2015.10.14 0/0
질문 이 오류좀 도와주세요..ㅠㅠ 2 횬히 2015.10.21 0/0
질문 Nox 비활성입력 해보신분? 2 _Crash 2015.10.15 0/0
질문 Gui ActiveX. 에서 Tab입력시 입력이들어가질않네요. ... 5 _Crash 2015.10.17 0/0
질문 비활성 붙여넣기 명령어 좀 알려주세요 ㅠㅠ 1 KAZUYA 2015.10.17 0/0
질문 Nox 에서 PostMessage 가 안되요. 4 마천루 2015.10.18 0/0
자유 오토핫키 질문좀 할ㄹ려고하는데 어디해야할지 몰라서 ... 수지가좋아 2015.10.17 0/0
질문 Gui ActiveX 에 Send,{Enter} 가 안들어가네요 ㅠㅠ. 3 _Crash 2015.10.20 0/0
질문 SciTE4AutoHotkey 질문드립니다. 2 doprop 2015.10.18 0/0
질문 document 엔터입력 1 _Crash 2016.04.16 0/0
자유 비활성 이미지서치 팁좀 주실 분 있나요... 4 sica 2016.01.22 0/0
질문 오토핫키 이미지 서치 질문하려구 합니다~ 2 서영욱 2015.10.22 0/0
질문 오토핫키 FTP 이용 다운로드 시 질문입니다. 5 2Yrs 2015.11.12 0/0
정보 팝업 알림, CleanNotify 3 예지력1 2015.11.11 4/0
Board Pagination Prev 1 ... 616263646566676869 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글