Jump to content
Sign in to follow this  
LDericher

Is it possible to wait for - and read - Messages?

Recommended Posts

LDericher

Hi, just stumbled in here^^,

Has anyone got an Idea how to realize this?

I've got a delphi-written program that can't send certain messages to certain windows.

But AutoIt can!

So, my question is: Is it possible for an AutoIt-written program to wait for messages?

I don't want to have another GUI messing around on my screen so, I'm dreaming of a call of this WinAPI-func postmessage/sendmessage in my Delphi-prog that sends ASCII-Codes to my AU3-script(running in the background) which is only waiting for these messages and then distributes them to the window I want them in.

Oh, what a sentence... can you still follow me? Good ^_^

By the way: Even if it may sound like that, I don't want to create any Bot or Virus with this knowledge!

If this was here already, please simply post a link to the old topic: I didn't know what to search for.

Thanks for giving me some of your time,

The LDer

Edit_1: If you don't understand what I need, pls post so I can try to make clearer.

Edited by LDericher

Share this post


Link to post
Share on other sites
Juvigy

Short - yes it is possible.

Long - for how to do it we will need a lot more details

Share this post


Link to post
Share on other sites
Yashied

If I understood you correctly then see the following examples.

Receiver

#Include <GuiConstantsEx.au3>
#Include <WinApi.au3>

global $MsgFlag = 0

$iMsg = _WinAPI_RegisterWindowMessage('MyProg_Msg')

GUICreate('')
GUIRegisterMsg($iMsg, "Receiver")

do
    if $MsgFlag then
        MsgBox(0, "", "OK!")
        $MsgFlag = 0
    endif
until GUIGetMsg() = $GUI_EVENT_CLOSE

func Receiver($hWnd, $iMsg, $iwParam, $ilParam)
    if $iwParam = 1 then
        $MsgFlag = 1
    endif
endfunc; ReceiveroÝ÷ ÚæÒzw^¯öÿ¹«­¢+Ø%¹±Õ±Ðí]¥¹Á¤¹ÔÌÐì((ÀÌØí¥5Íô}]¥¹A%}I¥ÍÑÉ]¥¹½Ý5ÍÍ ÅÕ½Ðí5åAɽ}5ÍÅÕ½Ðì¤)}M¹5ÍÍ Áá°ÀÌØí¥5ͰĤ

Share this post


Link to post
Share on other sites
LDericher

Sorry, but, can you explain your code? I'm new to this language so, I rather like Delphi^^

Anyway, I would like to send 246 different messages (ASCII 1-123 down and up) and have an Event, so like this:

Delphi sends:

SendMessage(AU3GUIHandle, WM_MyMsg, x, 0);
(while X is my number)

and in the AU3 the receiver:

Func OnMyMsg($MyMsg)
  WinActivate(...)
  Sleep(...);Whatever;)

and something that can call it:

[dontknowhowthislookslike]oO[/dontknowhowthislookslike]

Regards, the LDer


Share this post


Link to post
Share on other sites
ChrisL
LDericher

Now, can someone explain the "DllStruct" to make it some clearer?

I think it's a kind of dynamic Array, am I right?

Or does Someoneknow how to build the DllStruct in Delphi? Would be fine xD

LDer.


Share this post


Link to post
Share on other sites
Yashied

Now, can someone explain the "DllStruct" to make it some clearer?

I think it's a kind of dynamic Array, am I right?

Or does Someoneknow how to build the DllStruct in Delphi? Would be fine xD

LDer.

No need to create DllStruct in Delphi, there is a composite (Record) data types. ChrisL`s example based on WM_COPYDATA and only uses the WinAPI. All this can be implemented in Delphi. In my opinion AutoIt and Delphi looks very similar. At the expense of DllStrict see this.

Edit.

There are many ways to exchange data between processes, such as the following:

  • Memory-mapped files
  • WM_COPYDATA
  • Pipes
  • Mailslots
  • etc.
All this can be implemented in Delphi. Edited by Yashied

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×