🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by nicolasr Mon, 24 Mar 2003 22:44
Automating another application with SendMessage
#17440
Author: nicolasr
Date: Mon, 24 Mar 2003 22:44
19 lines
1676 bytes
Hi,

I'm trying to automate another application by sending messages to its main
form and child controls like buttons etc. The problem is that many Windows
messages have pointers to structures as WParam/LParam. As far as I know
those pointers are invalid in the address space of the other application, is
this correct?

I found a workaround for some of the controls but now I have to select an
entry in a list view in report style. The messages LVM_FINDITEM and
LVM_SETITEMSTATE both don't work since they require pointers as parameters.

Is there any common workaround for those cases? Or at least something I can
do in this special case with the list view?

By the way, I don't have source code for the other application.

thanks for any ideas,
Nick
Re: Automating another application with SendMessage
#17441
Author: Remy Lebeau (TeamB)
Date: Mon, 24 Mar 2003 23:07
32 lines
2263 bytes
"nicolasr" <nicolasrATSIGNgmx.net> wrote in message
news:3e7f8a59$1@newsgroups.borland.com...

> I'm trying to automate another application by sending
> messages to its main form and child controls like buttons etc.
> The problem is that many Windows messages have pointers
> to structures as WParam/LParam. As far as I know those
> pointers are invalid in the address space of the other
> application, is this correct?

Correct.  Only WM_COPYDATA allows data to be migrated between processes
without having to worry about the difference in address spaces.

> I have to select an entry in a list view in report style.
> The messages LVM_FINDITEM and LVM_SETITEMSTATE
> both don't work since they require pointers as parameters.

You have to be in the address space of the destination window in order to
send messages that use pointers.

> Is there any common workaround for those cases?

The only way I know of is to write an separate hook DLL that is designed to
intercept window messages, and then use SetWindowsHookEx() to inject the DLL
into the address space of the destination application.  Then you can send
the destination window a known message that the DLL can filter for and then
handle sending the LVM_... messages to the destination on behalf of your
application.


Gambit
Re: Automating another application with SendMessage
#17443
Author: nicolasr
Date: Mon, 24 Mar 2003 23:13
2 lines
1014 bytes
thanks for the help,
Nick
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads