Easiest method to pass messages to the thread of another process? 
Author Message
 Easiest method to pass messages to the thread of another process?

I have a sort of client server approach for solving a problem.

A dialog based app passes messages to a standalone executable.

Currently I launch the executable from my app via ::CreateProcess but the
executable gets very little processing time for its thread so I need to
launch it separately.

I wanted to know how to get a hold of the process' thread ID so I can pass
it messages via PostThreadMessage.  I know that worst case, I can go through
the window by finding the window name, but I'd rather just pass it to the
process like I am doing already...

There must be some way to pass a message to an arbitrary process (of course
this is a security risk...)

Thanks,

    WTH



Mon, 12 Sep 2005 23:08:59 GMT  
 Easiest method to pass messages to the thread of another process?
When you create the process you get a pointer to a PROCESS_INFORMATION
structure. This delivers you the ThreadId you can use to pass a message on
to this particular thread.

Here is the MSDN info on PROCESS_INFORMATION
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllp...
e/process_information_str.asp

Regards
Ian


Quote:
> I have a sort of client server approach for solving a problem.

> A dialog based app passes messages to a standalone executable.

> Currently I launch the executable from my app via ::CreateProcess but the
> executable gets very little processing time for its thread so I need to
> launch it separately.

> I wanted to know how to get a hold of the process' thread ID so I can pass
> it messages via PostThreadMessage.  I know that worst case, I can go
through
> the window by finding the window name, but I'd rather just pass it to the
> process like I am doing already...

> There must be some way to pass a message to an arbitrary process (of
course
> this is a security risk...)

> Thanks,

>     WTH



Tue, 13 Sep 2005 09:38:07 GMT  
 Easiest method to pass messages to the thread of another process?
Yes, but the problem is that this process can't have a higher priority than
the creating process and doesn't get enough of the processor's time when the
threads in the creating process get most of it...  For example, it is a 3D
app and when running on its own, 300+ frames per second.  When I create it
as a child process of my dialog app, 12 fps max...

So, I need to find a way to shell execute it and then send messages to it.
Starting it up is easy, using something besides FindWindow() and then
GetWindowThreadID is harder...

    WTH


Quote:
> I have a sort of client server approach for solving a problem.

> A dialog based app passes messages to a standalone executable.

> Currently I launch the executable from my app via ::CreateProcess but the
> executable gets very little processing time for its thread so I need to
> launch it separately.

> I wanted to know how to get a hold of the process' thread ID so I can pass
> it messages via PostThreadMessage.  I know that worst case, I can go
through
> the window by finding the window name, but I'd rather just pass it to the
> process like I am doing already...

> There must be some way to pass a message to an arbitrary process (of
course
> this is a security risk...)

> Thanks,

>     WTH



Tue, 13 Sep 2005 15:47:50 GMT  
 Easiest method to pass messages to the thread of another process?
Can you use the WM_COPYDATA message?


Quote:
> I have a sort of client server approach for solving a problem.

> A dialog based app passes messages to a standalone executable.

> Currently I launch the executable from my app via ::CreateProcess but the
> executable gets very little processing time for its thread so I need to
> launch it separately.

> I wanted to know how to get a hold of the process' thread ID so I can pass
> it messages via PostThreadMessage.  I know that worst case, I can go
through
> the window by finding the window name, but I'd rather just pass it to the
> process like I am doing already...

> There must be some way to pass a message to an arbitrary process (of
course
> this is a security risk...)

> Thanks,

>     WTH



Tue, 13 Sep 2005 16:42:13 GMT  
 Easiest method to pass messages to the thread of another process?
I already am using the clip board to store data that is related to the
messages I'm signalling, but how to signal the process?  I can't signal by
the presence of data on the clipboard, that's a little toooo hacky for me...

Again, if there isn't an easy solution, I'll just use "FindWindow" and
"GetWindowThreadID" and pass messages to that thread...

    Thanks everybody :),

        WTH



Quote:
> Can you use the WM_COPYDATA message?



> > I have a sort of client server approach for solving a problem.

> > A dialog based app passes messages to a standalone executable.

> > Currently I launch the executable from my app via ::CreateProcess but
the
> > executable gets very little processing time for its thread so I need to
> > launch it separately.

> > I wanted to know how to get a hold of the process' thread ID so I can
pass
> > it messages via PostThreadMessage.  I know that worst case, I can go
> through
> > the window by finding the window name, but I'd rather just pass it to
the
> > process like I am doing already...

> > There must be some way to pass a message to an arbitrary process (of
> course
> > this is a security risk...)

> > Thanks,

> >     WTH



Tue, 13 Sep 2005 16:51:35 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Pass Message to Create Window to Running Process

2. monitor message intended for another process/thread

3. message passing between threads

4. About Thread and Message Passing

5. Passing messages between threads?

6. Message passing between threads?

7. Passing messages between MFC threads?

8. passing stdin to a forked process, after writing some info to the process

9. Leight Weight Processing or Threads in one UNIX process

10. MFC UI Thread doesnt start when COM method called in multi-threaded MFC dialog App

11. Process Windows Messages during lengthy process

12. Set thread priorities for all threads in a process

 

 
Powered by phpBB® Forum Software