Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass string between applications using SendMessage in C++

Is it possible to pass char* between 2 applications using a custom message in SendMessage? I know it is possible using WM_COPYDATA, but I want to know if I can send this using custom message(WM_USER + ..)

Thank you!

like image 403
Mircea Ispas Avatar asked Sep 05 '26 16:09

Mircea Ispas


1 Answers

WM_COPYDATA has been specifically invented because what you ask is not feasible directly. This because different applications live in different address spaces, so a pointer passed from an application has no meaning in another one.

WM_COPYDATA deals with the problem by using some IPC mechanism under the hood, which is what you usually do when you want to share data with another application; viable options are the usual ones: pipes, shared memory & co, have a look here to see what Windows provides.

like image 150
Matteo Italia Avatar answered Sep 07 '26 10:09

Matteo Italia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!