예지력
W
예지력

블로그 메뉴

  • 문의 & 피드백
  • GitHub
  • 분류 전체보기
    • 주식
    • 파생상품
    • crypto
      • 차트에 현대미술
      • 복기
      • 시스템 트레이딩
      • 기술적 분석
      • 블록체인
      • 생각
      • 리서치
      • Token Engineering
    • 이더리움 | ETH
      • 리서치
    • 테라 | LUNA
      • Tefi
      • 루나 LUNA
      • 아스트로포트 Astro
      • 앵커 프로토콜 ANC
      • 미러 프로토콜 MIR
      • 아폴로 다오 APOLLO
      • 프리즘 프로토콜 PRISM
      • 넥서스 프로토콜 NEXUS
      • 레바나 프로토콜 LEV
      • 마스 프로토콜 MARS
      • 더비 스타즈 Derby Stars
    • 프로그래밍
      • AHK 메뉴얼
      • AHK 레퍼런스
      • Delphi XE7
      • C
      • Python
      • Reversing
      • Archive
    • 일상
    • 영화
    • 낙서장
    • Deprecated
      • 로다 플레이어
      • 어의

인기 글

최근 댓글

전체 방문자
오늘
어제

티스토리

hELLO · Designed By 정상우.
예지력

W

프로그래밍/Archive

WinWaitCreated()

2015. 10. 17. 09:00

Language : AutoHotkey_L

Author : HotKeyit

Function : Wait for a window to be created

Source : http://ahkscript.org/boards/viewtopic.php?f=6&t=1274

 

 

/*
Wait for a window to be created, returns 0 on timeout and ahk_id otherwise
Parameter are the same as WinWait, see http://ahkscript.org/docs/commands/WinWait.htm
Forum: http://ahkscript.org/boards/viewtopic.php?f=6&t=1274&p=8517#p8517
*/

WinWaitCreated( WinTitle:="", WinText:="", Seconds:=0, ExcludeTitle:="", ExcludeText:="" ) {
; HotKeyIt - http://ahkscript.org/boards/viewtopic.php?t=1274
static Found := 0, _WinTitle, _WinText, _ExcludeTitle, _ExcludeText
, init := DllCall( "RegisterShellHookWindow", "UInt",A_ScriptHwnd )
, MsgNum := DllCall( "RegisterWindowMessage", "Str","SHELLHOOK" )
, cleanup:={base:{__Delete:"WinWaitCreated"}}
If IsObject(WinTitle) ; cleanup
return DllCall("DeregisterShellHookWindow","PTR",A_ScriptHwnd)
else if (Seconds <> MsgNum){ ; User called the function
Start := A_TickCount, _WinTitle := WinTitle, _WinText := WinText
,_ExcludeTitle := ExcludeTitle, _ExcludeText := ExcludeText
,OnMessage( MsgNum, A_ThisFunc ), Found := 0
While ( !Found && ( !Seconds || Seconds * 1000 < A_TickCount - Start ) )
Sleep 16
Return Found,OnMessage( MsgNum, "" )
}
If ( WinTitle = 1 ; window created, check if it is our window
&& ExcludeTitle = A_ScriptHwnd
&& WinExist( _WinTitle " ahk_id " WinText,_WinText,_ExcludeTitle,_ExcludeText))
WinWait % "ahk_id " Found := WinText ; wait for window to be shown
}

728x90
저작자표시 비영리 동일조건 (새창열림)

'프로그래밍 > Archive' 카테고리의 다른 글

[Lib] Class Msgbox  (6) 2015.11.27
[Lib] CleanNotify  (4) 2015.11.21
MS Office Style Gui 프로토타입  (4) 2015.10.09
GetActiveObjects 활성중인 객체를 불러온다  (0) 2015.03.04
L 유니코드32비트 1.1.19.03  (11) 2015.02.21
    '프로그래밍/Archive' 카테고리의 다른 글
    • [Lib] Class Msgbox
    • [Lib] CleanNotify
    • MS Office Style Gui 프로토타입
    • GetActiveObjects 활성중인 객체를 불러온다
    예지력
    예지력

    티스토리툴바