🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17441

Re: Automating another application with SendMessage

#17441
From: 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
Technical Details
Message-ID: <3e7f8d79@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e7f8a59$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,643e5bac4901b56b
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-24 15:04:03 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e7f8a59$1@newsgroups.borland.com>
Subject: Re: Automating another application with SendMessage
Date: Mon, 24 Mar 2003 15:07:48 -0800
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e7f8d79@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048546681 207.175.226.26 (24 Mar 2003 14:58:01 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail