Discussion:
SendMessage(... LB_GETTEXT ...) between Processes - doesn't work !
(too old to reply)
Andrew
2006-05-22 13:13:01 UTC
Permalink
Hi, Brothers!

There is quite _strange_ situation:
I have two app. One of them has ListBox control (let's call it Host).
Another one (let's call it User) - should read content of this ListBox.
UserApp allocates with VirtualAllocEx a memory block (sure inside of
HostApp). Then it sends message

SendMessage(... LB_GETTEXT ...)

to the HostApp. After that I read memory block ( ReadProcessMemory ) that
was allocated before. Pointer to this memory block sure are passed in
SendMessage call.

AND! SendMessage returns -1, content of memory block has not any
modifications :(((
Index of requested item of list box - is correct.

What possibly do I wrong?
How could it be???

A lot of thanks in advance. Any hints, any ideas - will be highly appreciated.
Christian ASTOR
2006-05-22 13:45:15 UTC
Permalink
Post by Andrew
Hi, Brothers!
I have two app. One of them has ListBox control (let's call it Host).
Another one (let's call it User) - should read content of this ListBox.
UserApp allocates with VirtualAllocEx a memory block (sure inside of
HostApp). Then it sends message
SendMessage(... LB_GETTEXT ...)
You don't need VirtualAllocEx() for LB_GETTEXT...
Gary Chanson
2006-05-22 17:54:49 UTC
Permalink
Post by Andrew
Hi, Brothers!
I have two app. One of them has ListBox control (let's call it Host).
Another one (let's call it User) - should read content of this ListBox.
UserApp allocates with VirtualAllocEx a memory block (sure inside of
HostApp). Then it sends message
SendMessage(... LB_GETTEXT ...)
to the HostApp. After that I read memory block ( ReadProcessMemory ) that
was allocated before. Pointer to this memory block sure are passed in
SendMessage call.
AND! SendMessage returns -1, content of memory block has not any
modifications :(((
Index of requested item of list box - is correct.
What possibly do I wrong?
How could it be???
A lot of thanks in advance. Any hints, any ideas - will be highly appreciated.
LB_GETTEXT is assuming that the pointer references memory in the client
process and does the appropriate marshalling for you. Don't try to do it
yourself.

--

- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools
Andrew
2006-05-23 12:33:01 UTC
Permalink
Christian ASTOR: You don't need VirtualAllocEx() for LB_GETTEXT...

Gary Chanson: LB_GETTEXT is assuming that the pointer references memory in
the client process and does the appropriate marshalling for you. Don't try
to do it
yourself.


ern .......... HM.........


JUST SUPERB!!!

But how come?

Yep. Your advice, guys, realy HAS HELPED me. Now everything DOES WORK Fine.
All my experiments and general way was inspired by article

http://www.codeproject.com/threads/int64_memsteal.asp

and I Sencerely believed that discussed there case - is MY case. So - I
tried to go in the same way.

And after All that only OneQuestion really does harass me: where from, how
should I have known about behaviour and requrements, expectations of
SendMessage and LB_GETTEXT regarding allocated memory??????????????????

InterProc issues in MSDN are discussed TOO Lowly as it seems to me :(

Where can I read about all this cases and aboul stuff like that. WHERE?
Please, TELL ME, Guys. I wanna be clever like you! :) And don't want to
waste so much time in vain any more. I bet!


T H A N K S !!!

Loading...