Sending messages form one to another app ?? WM_COPYDATA how ? 
Author Message
 Sending messages form one to another app ?? WM_COPYDATA how ?

I have 2 MFC applikations and I would like to tell the one applikation what
to do from the other.

I have found out that it is possible to send data from one applikation to
another with the WM_COPYDATA message, but how do I send and recive this
message ??

I Guess that I have to use SendMessage, but how is this done in MFC ?
IN SDK I have to use the the recive HWND and the sending HWND, but how do
get these handles in MFC?

I hope that some one can help me with this !

Thomas



Sun, 14 Jan 2001 03:00:00 GMT  
 Sending messages form one to another app ?? WM_COPYDATA how ?
I think I did this a couple of years ago and I think it worked something
like this.

Define a new window class for the main windows of the two app.

i.e WNDCLASS class1;
    class1.lpszClassName="App1MainWindow"
    RegisterClass(&class1);

    WNDCLASS class2;
    class2.lpszClassName="App2MainWindow"
    RegisterClass(&class2);

If each app knows the class name of the other apps main Window you can use
FindWindow to get the window handle of the other apps main Window and then
PostMessages to it.

e.g in App1

CWnd *pWndApp2=CWnd::FindWindow("App2MainWindow",NULL);

if(pWnd != NULL)
{
    pWnd->SendMessage(.......

Quote:
}

similar in App2

There is a technical note which describes how to change the Window class for
MFC apps.
(TN001: Window Class Registration).

We used to store the actual class names in an ini file so that the apps can
read each others class names at run time.

This method worked ok in Windows 3.1 I've not tried it on 95/NT.
Hope this helps.

Quote:

>I have 2 MFC applikations and I would like to tell the one applikation what
>to do from the other.

>I have found out that it is possible to send data from one applikation to
>another with the WM_COPYDATA message, but how do I send and recive this
>message ??

>I Guess that I have to use SendMessage, but how is this done in MFC ?
>IN SDK I have to use the the recive HWND and the sending HWND, but how do
>get these handles in MFC?

>I hope that some one can help me with this !

>Thomas



Sun, 14 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Sending a message from one app to another on NT

2. Trying to send a message from one app to another

3. Sending a message from one app to another on NT

4. Problem in sending WM_COPYDATA message

5. Sending a message from VB-app to VC-app

6. Sending message to a form

7. Send focus message from one control to another?

8. How to send messages to a form object

9. Sending a simple message from one PC to another over network

10. how does one know which scroll bar sent message

11. Can one send a ON_COMMAND Message?

12. Send focus message from one control to another?

 

 
Powered by phpBB® Forum Software