Prev: Runtime error-help plz.
Next: uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined
From: Scott McPhillips [MVP] on 1 Jul 2007 10:13 David Ching wrote: > I wonder why Windows takes care of marshalling pointers for some messages, > such as WM_GETTEXT, but not for others. For example, > SendMessage(WM_GETTEXT, ...) does work across processes. It seems if they > marshalled some messages they would marshall all of them. WM_GETTEXT was handled as a special case to provide compatibility with Windows 3.1 programs (16 bit). -- Scott McPhillips [MVP VC++]
From: Alexander Grigoriev on 1 Jul 2007 10:34 WM_NOTIFY has too many variants. I think USER32 will only marshal messages that DefWndProc handles, and user32 ever generates. WM_NOTIFY comes from comctrl32. "David Ching" <dc(a)remove-this.dcsoft.com> wrote in message news:SaGhi.664$eY.426(a)newssvr13.news.prodigy.net... > "Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message > news:0iae83tncd7dasjl3rq18e67c4v272g38h(a)4ax.com... >> Window handles are global but pointers definitely are not, and so you >> can't send a >> WM_NOTIFY as you are trying to do because the pointer is a pointer to >> some other process. >> >> this is why OLE automation was invented. > > I wonder why Windows takes care of marshalling pointers for some messages, > such as WM_GETTEXT, but not for others. For example, > SendMessage(WM_GETTEXT, ...) does work across processes. It seems if they > marshalled some messages they would marshall all of them. I've heard the > rule is messages below WM_USER are marshalled, but not others, but have > not confirmed this. > > -- David >
From: Joseph M. Newcomer on 1 Jul 2007 16:25 This was handled as a special case because of its importance, particularly because a huge number of programs depended on being able to get window captions. It is one of the very, very, very, very few messages that actually works this way. joe On Sun, 01 Jul 2007 04:36:02 GMT, "David Ching" <dc(a)remove-this.dcsoft.com> wrote: >"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message >news:0iae83tncd7dasjl3rq18e67c4v272g38h(a)4ax.com... >> Window handles are global but pointers definitely are not, and so you >> can't send a >> WM_NOTIFY as you are trying to do because the pointer is a pointer to some >> other process. >> >> this is why OLE automation was invented. > >I wonder why Windows takes care of marshalling pointers for some messages, >such as WM_GETTEXT, but not for others. For example, >SendMessage(WM_GETTEXT, ...) does work across processes. It seems if they >marshalled some messages they would marshall all of them. I've heard the >rule is messages below WM_USER are marshalled, but not others, but have not >confirmed this. > >-- David > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 1 Jul 2007 16:27 Thanks, David, I couldn't remember that it was you who had done this. I'd posted a response that said it existed. joe On Fri, 29 Jun 2007 14:51:49 -0700, "David Ching" <dc(a)remove-this.dcsoft.com> wrote: > >"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message >news:K5adnVn9ws6emhjbnZ2dnUVZ_gCdnZ2d(a)comcast.com... >> Headache wrote: >>> Hello, >>> >>> I'm using a program to drive a GUI. For simple messages such as >>> LB_SETSEL the PostMessage API works fine. I use SendMessage for >>> WM_NOTIFY as it takes the address of a local NMITEMACTIVATE structure. >> >> An address in your process is useless in another process. So even if the >> message was passed by Windows it would not contain a valid pointer. I >> don't know if Windows suppresses such a cross-process WM_NOTIFY, but it >> would be a real good idea if it does. >> >> One option that you could use is to send the WM_COPYDATA message to the >> other process. Windows provides support for this message by copying the >> passed data into the receiving process' memory. >> >> -- > >To add to Scott's thought that passing fixed addresses to another process is >wrong, see >http://groups.google.com/group/microsoft.public.vc.mfc/browse_frm/thread/40c00794fa444323/291326274362ef36?lnk=st&q=dcsoft+sendmessageremote&rnum=1#291326274362ef36 >which discusses my SendMessageRemote() function which sounds ideal for your >situation. > >-- David > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Ching on 1 Jul 2007 16:31 "Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message news:eb3g835kcr8bfllckal6ihe85m28da8gv2(a)4ax.com... > This was handled as a special case because of its importance, particularly > because a huge > number of programs depended on being able to get window captions. It is > one of the very, > very, very, very few messages that actually works this way. I repeat: It seems if they marshalled some messages they would marshall all of them. Who's to say that getting a foreign process's window caption is important but not the state of a toolbar button within that window? I need to do both, that's why I created SendMessageRemote(), but it shouldn't have been necessary. -- David
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Runtime error-help plz. Next: uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined |