Hi everyone,
This is the first time i'm using this forum so i'm not sure how this is done, anyway my qustion is as the topic says.
I'm trying to send a simple message like "hello" from let's say Application1 to Application2 in "Borland C++ Builder 6"
1) how do i send a message
2) how do i receive the message
I been reading and searching and so far the only thing i been able to do is to find the handle for a application by using:
HANDLE hwnd = FindWindow(0,"Application1");
I think the function "SendAppMessage" could be used for sending a message but there is not much help or example for this :(
I realy appreciate it if anyone could help me with this problem.
Thanks
/reza666
now you can send a message just like any other windows message, and since you created both application1 and 2 you can make your own message. for instance:
somewhere in app1 and app2 globally declare a message like
#define WM_MYMESSAGE WM_APP+1
you can also use WM_USER+1
now both apps now the value of WM_MYMESSAGE
next from app1:
SendMessage(app2handle,WM_
now here's the part im not sure of cause your using a builder program. i'm not sure if you can see the window proc for the app2, if you can you have to look for the message. in win32 api you would ass another case to the switch statment in the window proc
IE.
........
case WM_PAINT
'BLAH BLAH IM JUST SHOWING THIS AS AN EXAMPLE
break;
case WM_MYMESSAGE:
MessageBox(NULL,(char*)lPa
break;
case .......
..
...
now this might not apply to you builders are known to hide the specifics of the window proc from you which is bad as you can see (if yours does..)
btw if you did want to send the text to an edit then you have to get the handle to that edit
FindWindowEx is used for that you have to narrow a search down for it depending on where it is in the form
for example
edit = FindWindowEx(handletomainw
then again i doubt a builder would have the class be the normal edit, it might be something like "TEdit"
then you would use
SendMessage(edit,WM_SETTEX
hope it helps..