<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK:WM_COPYDATA]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=10567</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10567&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK:WM_COPYDATA».]]></description>
		<lastBuildDate>Fri, 10 Apr 2015 09:14:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93193#p93193</link>
			<description><![CDATA[<p>Все вопросы снимаются, strget не работает в wince, обращение к заголовкам форм не работает в wince, только по хендлу окна</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 09:14:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93193#p93193</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93188#p93188</link>
			<description><![CDATA[<p>Много чего знаем про кодировки. teadrinker, если не знаете чем помоч, просто не мешайте и не засоряйте&nbsp; тему. Ваши предвзятые ответы смысл которых: &quot;мальчик иди учи матчасть&quot;, совершенно не несут пользы.</p><p>Подскажите работает ли в wince функция ControlGetText или функции которые обращаются к заголовку окна? В Windows все эти функции типа winget видят по заголовку окна, а в wince нет. Может объявление заголовков другие?</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 08:46:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93188#p93188</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93185#p93185</link>
			<description><![CDATA[<p>Про кодировки текста знаете что-нибудь?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 10 Apr 2015 08:09:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93185#p93185</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93180#p93180</link>
			<description><![CDATA[<p>Скачал последнюю версию под wince. При попытке выполнить любой скрипт запуском AutohotkeyCE.exe scr.ahk выдает ошибку приложения AutohotkeyCE.exe</p><p>Скомпилилровал последним компилятором в exe этот скрипт, запустилось, ловит сообщение, но вместо строки какие то символы, квадратики.&nbsp; <a href="http://rghost.ru/8HRpXqLWx">exe wince</a></p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 06:37:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93180#p93180</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93177#p93177</link>
			<description><![CDATA[<p>Установил Version v1.1.21.02<br />В Windows заработало. Попробую поискать рабочую версию для wince.</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 05:46:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93177#p93177</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93176#p93176</link>
			<description><![CDATA[<p>Скрипт в справке, который предназначен для приема, не работает. Не извлекает строку из WM_COPYDATA от внешнего приложения.</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 05:35:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93176#p93176</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93175#p93175</link>
			<description><![CDATA[<p>Так в примере из справки именно строка извлекается. Вы пример с двумя скриптами запускали? Работает он вас именно в том виде, как в справке?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 10 Apr 2015 05:32:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93175#p93175</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93174#p93174</link>
			<description><![CDATA[<p>Есть программа которая шлет WM_COPYDATA со строкой. На ahk получается поймать это сообщение например в примере выше. Но нужно достать по указателю строку из этого сообщения, а это сделать на ahk не получается. Смысла в отлове WM_COPYDATA нет если не извлекать из него данные.</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 05:22:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93174#p93174</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93173#p93173</link>
			<description><![CDATA[<div class="quotebox"><cite>alex208210 пишет:</cite><blockquote><p>Смотрел, ничего не работает</p></blockquote></div><p>В смысле, вообще не работает, или конкретно с вашим примером не работает?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 10 Apr 2015 05:18:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93173#p93173</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93170#p93170</link>
			<description><![CDATA[<p><span style="color: green"><strong>alex208210</strong>, похоже, вы плохо ознакомились с указанной ранее темой. У нас принято использовать заглавные буквы и точки в конце предложений.</span></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 10 Apr 2015 04:58:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93170#p93170</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93169#p93169</link>
			<description><![CDATA[<p>Смотрел, ничего не работает, примеры пересмотрены со всех возможных к поиску сайтов, было&nbsp; перепробовано 3-4 примера и ниодин не работает, поэтому и создал уже тему, может кто сможет решить проблему.</p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Fri, 10 Apr 2015 04:25:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93169#p93169</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93165#p93165</link>
			<description><![CDATA[<p>Смотрите пример из справки <a href="http://ahkscript.org/docs/commands/OnMessage.htm">OnMessage</a>.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 09 Apr 2015 22:46:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93165#p93165</guid>
		</item>
		<item>
			<title><![CDATA[AHK:WM_COPYDATA]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93162#p93162</link>
			<description><![CDATA[<p>Привет друзья. Помогите поймать сообщениее WM_COPYDATA со строкой из внешней программы. Я пишу под wince.<br />Если&nbsp; запустить sender, он пошлет сообщение для всех окон WM_COPYDATA со строкой hello. Если запустить listener, он получает сообщение и выводит строку. <br />Но на AHK сделать слушателя не получается, который мог бы принять эти сообщения. </p><p>Я пытался написать такой код:</p><div class="codebox"><pre><code>
Gui, +AlwaysOnTop
Gui, Add, Text, vtextv w400 h60
Gui, Show

StrGet(Address, Length=-1, Encoding=0)
{
    if A_IsUnicode
    {
        MsgBox %A_ThisFunc% does not support Unicode. Use the AutoHotkey_L (revision 46+) built-in version instead. The script will now exit.
        ExitApp
    }
    
    ; Flexible parameter handling:
    if Length is not integer
        Encoding := Length,  Length := -1
    
    ; Check for obvious errors.
    if (Address+0 &lt; 1024)
        return
    
    ; Ensure &#039;Encoding&#039; contains a numeric identifier.
    if Encoding = UTF-16
        Encoding = 1200
    else if Encoding = UTF-8
        Encoding = 65001
    else if SubStr(Encoding,1,2)=&quot;CP&quot;
        Encoding := SubStr(Encoding,3)
    
    if !Encoding ; &quot;&quot; or 0
    {
        ; No conversion necessary, but we might not want the whole string.
        if (Length == -1)
            Length := DllCall(&quot;lstrlen&quot;, &quot;uint&quot;, Address)
        VarSetCapacity(String, Length)
        DllCall(&quot;lstrcpyn&quot;, &quot;str&quot;, String, &quot;uint&quot;, Address, &quot;int&quot;, Length + 1)
    }
    else if Encoding = 1200 ; UTF-16
    {
        char_count := DllCall(&quot;WideCharToMultiByte&quot;, &quot;uint&quot;, 0, &quot;uint&quot;, 0x400, &quot;uint&quot;, Address, &quot;int&quot;, Length, &quot;uint&quot;, 0, &quot;uint&quot;, 0, &quot;uint&quot;, 0, &quot;uint&quot;, 0)
        VarSetCapacity(String, char_count)
        DllCall(&quot;WideCharToMultiByte&quot;, &quot;uint&quot;, 0, &quot;uint&quot;, 0x400, &quot;uint&quot;, Address, &quot;int&quot;, Length, &quot;str&quot;, String, &quot;int&quot;, char_count, &quot;uint&quot;, 0, &quot;uint&quot;, 0)
    }
    else if Encoding is integer
    {
        ; Convert from target encoding to UTF-16 then to the active code page.
        char_count := DllCall(&quot;MultiByteToWideChar&quot;, &quot;uint&quot;, Encoding, &quot;uint&quot;, 0, &quot;uint&quot;, Address, &quot;int&quot;, Length, &quot;uint&quot;, 0, &quot;int&quot;, 0)
        VarSetCapacity(String, char_count * 2)
        char_count := DllCall(&quot;MultiByteToWideChar&quot;, &quot;uint&quot;, Encoding, &quot;uint&quot;, 0, &quot;uint&quot;, Address, &quot;int&quot;, Length, &quot;uint&quot;, &amp;String, &quot;int&quot;, char_count * 2)
        String := StrGet(&amp;String, char_count, 1200)
    }
    return String
}

#SingleInstance
OnMessage(0x4a, &quot;Receive_WM_COPYDATA&quot;) 
return

Receive_WM_COPYDATA(wParam, lParam)
{
    StringAddress := NumGet(lParam + 2 *A_PtrSize)
    CopyOfData := StrGet(StringAddress)
    guicontrol, ,textv ,Received the following string: %CopyOfData%
    return true
}

guiclose:
exitapp
</code></pre></div><p>Скачать sender и listener можно <a href="http://rghost.ru/7sh2mtP9P">здесь</a>. Sender шлет раз в секунду сообщение WM_COPYDATA со строкой hello всем окнам.</p><p>Код sender:<br /></p><div class="codebox"><pre><code>
procedure senderstr;
var
  MyCopyDataStruct: TCopyDataStruct;
begin
  with MyCopyDataStruct do
  begin
    cbData:= StrLen(PChar(&#039;hello&#039;)) + 1;
    lpData:= PChar(&#039;hello&#039;)
  end;
  SendCopyData(HWND_BROADCAST,MyCopyDataStruct);
end;

procedure SendCopyData(hTargetWnd: HWND; ACopyDataStruct:TCopyDataStruct);
begin
  if hTargetWnd&lt;&gt;0 then
    SendMessage(hTargetWnd, WM_COPYDATA, Longint(Form1.Handle), Longint(@ACopyDataStruct))
  else
    ShowMessage(&#039;No Recipient found!&#039;);
end;
</code></pre></div><p>код слушателя</p><div class="codebox"><pre><code>
function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall;
Var
  pMyData  : CopyDataStruct;
begin
  if uMsg=WM_COPYDATA then
     begin
     pMyData:= PCopyDataStruct(lParam)^;
     form1.memo1.lines.add(PChar(pMyData.lpData));
     end;
  result:= CallWindowProc(PrevWndProc,Ahwnd,uMsg,WParam,LParam);
end;
</code></pre></div><p>В Windows тоже не работает отлов сообщений, <a href="http://rghost.ru/6ll5RYjHC">скачать exe</a></p>]]></description>
			<author><![CDATA[null@example.com (alex208210)]]></author>
			<pubDate>Thu, 09 Apr 2015 20:17:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93162#p93162</guid>
		</item>
	</channel>
</rss>
