<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Ждать пока у программы появится крестик для закрытия]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9698&amp;type=atom" />
	<updated>2014-06-11T18:46:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9698</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Ждать пока у программы появится крестик для закрытия]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83831#p83831" />
			<content type="html"><![CDATA[<p>Решил таким кодом:<br /></p><div class="codebox"><pre><code>hWnd:=WinExist(&quot;A&quot;)
hSysMenu:=DllCall(&quot;GetSystemMenu&quot;,&quot;Int&quot;,hWnd,&quot;Int&quot;,FALSE)
if hSysMenu != 0
   msgbox</code></pre></div><p>И все-таки мне непонятно, почему Acc не находит?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-06-11T18:46:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83831#p83831</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Ждать пока у программы появится крестик для закрытия]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83829#p83829" />
			<content type="html"><![CDATA[<p>Вот такой код не работает:<br /></p><div class="codebox"><pre><code>f11::

Loop
    If ExistAccName(WinExist(&quot;A&quot;), &quot;Close&quot;)  
        MsgBox
    return 

ExistAccName(winid, Desc)
{
    if !IsObject(AccObj := Acc_ObjectFromWindow(winid))
        Return 0 ;  &quot;Не удалось получить IAccessible&quot;  
    Return FindAccName(AccObj, Desc) ? 1 : 0
}    

FindAccName(AccObj, Desc)
{    
    try if (AccObj.accName(0) = Desc)  
        Return 1

    for k, v in Acc_Children(AccObj)
        if FindAccName(v, Desc)  
            Return 1
}  </code></pre></div><p>А такой работает (при навидении мышкой на крестик выскакивает msgbox):<br /></p><div class="codebox"><pre><code>loop
{
   Acc :=    Acc_ObjectFromPoint(child) 
   if   (Acc.accName(child)=&quot;Close&quot;)
      msgbox
}</code></pre></div><p>Что изменить в первом, чтобы при нахождении крестика в активном окне выдавался msgbox?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-06-11T16:26:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83829#p83829</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Ждать пока у программы появится крестик для закрытия]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83828#p83828" />
			<content type="html"><![CDATA[<p>А почему через AccDescription не получается?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-06-11T15:11:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83828#p83828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Ждать пока у программы появится крестик для закрытия]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83820#p83820" />
			<content type="html"><![CDATA[<p>Возможно SetWinEventHook, и возможно <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd318066(v=vs.85).aspx">EVENT_OBJECT_CREATE</a>.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-06-11T12:43:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83820#p83820</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Ждать пока у программы появится крестик для закрытия]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83818#p83818" />
			<content type="html"><![CDATA[<p>Задача - дождаться пока загрузится программа.<br />Когда она загрузится появляется в правом углу крестик для закрытия.<br />Как этот момент определить?<br />Через Aсс не получается.<br /></p><div class="codebox"><pre><code>Loop
    If ExistAccDescription(WinExist(&quot;A&quot;), &quot;Closes the window&quot;)  
        MsgBox
    return 

ExistAccDescription(winid, Desc)
{
    if !IsObject(AccObj := Acc_ObjectFromWindow(winid))
        Return 0 ;  &quot;Не удалось получить IAccessible&quot;  
    Return FindAccDescription(AccObj, Desc) ? 1 : 0
}    

FindAccDescription(AccObj, Desc)
{    
    try if (AccObj.accDescription(0) = Desc)  
        Return 1

    for k, v in Acc_Children(AccObj)
        if FindAccDescription(v, Desc)  
            Return 1
}  </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-06-11T12:38:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83818#p83818</id>
		</entry>
</feed>
