Miscellaneous messages

From Team Developer SqlWindows Wiki
Jump to: navigation, search

Messages miscellaneous


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.


Here how to do it.

First declare two WinAPI functions PostThreadMessageA and GetCurrentThreadId.

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

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

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