Difference between revisions of "Miscellaneous messages"

From Team Developer SqlWindows Wiki
Jump to: navigation, search
(New page: This page covers miscellaneous messages tips & tricks. __TOC__ <br> <h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;border:1px solid #afa3bf;text-align:left;...)
 
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
This page covers miscellaneous messages tips & tricks.
+
{{PageHeader|Messages miscellaneous}}
 +
 
  
 
__TOC__
 
__TOC__
<br>
 
  
<h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;border:1px solid #afa3bf;text-align:left;color:#000;padding:0.2em 0.4em;">[[Image:Pointer.png]]How to send a message to the Application Actions section</h2>
+
 
 +
<!------------------------------------------------------------------------------------------------------------------------------>
 +
{{TipHeader|How to send a message to the Application Actions section}}
 
You can send messages to applications by using the thread ID of the running process.<br>
 
You can send messages to applications by using the thread ID of the running process.<br>
In TD the message will be received at the Application Actions section.<br><br>
+
In TD the message will be received at the '''Application Actions''' section.<br>
 +
 
 +
 
 +
[[image:SendAppMessage.png]]
 +
 
 +
 
 
Here how to do it.<br>
 
Here how to do it.<br>
<br>
+
 
 +
 
 
First declare two WinAPI functions [http://msdn.microsoft.com/en-us/library/ms644946(VS.85).aspx <b>PostThreadMessageA</b>] and [http://msdn.microsoft.com/en-us/library/ms683183(VS.85).aspx <b>GetCurrentThreadId</b>].
 
First declare two WinAPI functions [http://msdn.microsoft.com/en-us/library/ms644946(VS.85).aspx <b>PostThreadMessageA</b>] and [http://msdn.microsoft.com/en-us/library/ms683183(VS.85).aspx <b>GetCurrentThreadId</b>].
  
Line 32: Line 40:
  
 
Now, here the code to send a message to the Application Actions level:
 
Now, here the code to send a message to the Application Actions level:
 +
 
<pre>
 
<pre>
 
   ! Get the thread ID of this running application
 
   ! Get the thread ID of this running application
Line 39: Line 48:
 
</pre>
 
</pre>
  
Here you can download a sample:
+
 
*[http://www.xs4all.nl/~dapjr/TD/Samples/WIKI_SendApplicationMessage.zip WIKI_SendApplicationMessage.zip]<br>
+
Here you can download a sample:<br>
<br>
+
{{Download
 +
|URL=http://samples.tdcommunity.net/index.php?dir=&file=WIKI_SendApplicationMessage.zip
 +
|TEXT=WIKI_SendApplicationMessage.zip
 +
}}
 +
 
 +
 
 +
 
 +
[[Category:Messages]]

Latest revision as of 11:12, 29 October 2013

Messages miscellaneous


Contents


Pointer2.png How to send a message to the Application Actions section Pointer.png

You can send messages to applications by using the thread ID of the running process.
In TD the message will be received at the Application Actions section.


SendAppMessage.png


Here how to do it.


First declare two WinAPI functions PostThreadMessageA and GetCurrentThreadId.

Library name: USER32.DLL
   Function: PostThreadMessageA
      Export Ordinal: 0
      Returns
         Boolean: BOOL
      Parameters
         Number: DWORD
         Number: UINT
         Number: WPARAM
         Number: LPARAM

Library name: KERNEL32.DLL
   Function: GetCurrentThreadId
      Export Ordinal: 0
      Returns
         Number: DWORD
      Parameters

Now, here the code to send a message to the Application Actions level:

  ! Get the thread ID of this running application
  Set nCurrentThreadID = GetCurrentThreadId(  )
  ! Send a message to the thread. It will be received in the Application Actions
  Call PostThreadMessageA( nCurrentThreadID, PAM_AnyMessage, 0, 0 )


Here you can download a sample:
Down.png WIKI_SendApplicationMessage.zip