DPrometheus
Regular
Hey there
For the several applications rolled out right now we want a single module to handle inter-application communication. i.e. we have one application (called App1 for simplicity) and with a button in this application we switch to another application (called App2). we want to exchange information such as patient number etc.
My guess was to use Postmessage / sendmessage for this. All works fine, until we got to the point in which we have to communicate strings instead of numbers. An integer was easy to convert to a Intptr with
new IntPtr(intValue)
however creating an intptr from a string and send this pointer won't work.
We also saw there was an overloaded sendmessage with a stringbuilder, but the receiving application receives other characters then those which were sent. As a third we tried to dissassemble the string and send it as bytes. as in this solution. While this solution works my co-workers ain't happy with such a kind of a work-a-round. if we can't send the string this project will come to an end, and we are bound to use an even more cumbersome solution, namely something with an invisible button, which we can change its caption with a call to SetWindowText. Thereafter on a text change we can read the string and dependent on some codes we can trace back what kind of 'message' is posted.
I'm definitely convinced we shouldn't go for this, but if we can't find a way to send strings with a postmessage or sendmessage, I have no other option then to give in.
Does someone know if it can be achieved in .NET? WM_SETTEXT is capable of sending strings, so somehow it should be possible in my opinion. Also in native code (where I program in @home) this ain't a problem, and is definitely possible.
Someone any suggestions or tips?
Maybe it's just me who's stubborn, I just want to know what's best to do, and if possible know how to send strings using messages.
thanks in advance
~DP
For the several applications rolled out right now we want a single module to handle inter-application communication. i.e. we have one application (called App1 for simplicity) and with a button in this application we switch to another application (called App2). we want to exchange information such as patient number etc.
My guess was to use Postmessage / sendmessage for this. All works fine, until we got to the point in which we have to communicate strings instead of numbers. An integer was easy to convert to a Intptr with
new IntPtr(intValue)
however creating an intptr from a string and send this pointer won't work.
We also saw there was an overloaded sendmessage with a stringbuilder, but the receiving application receives other characters then those which were sent. As a third we tried to dissassemble the string and send it as bytes. as in this solution. While this solution works my co-workers ain't happy with such a kind of a work-a-round. if we can't send the string this project will come to an end, and we are bound to use an even more cumbersome solution, namely something with an invisible button, which we can change its caption with a call to SetWindowText. Thereafter on a text change we can read the string and dependent on some codes we can trace back what kind of 'message' is posted.
I'm definitely convinced we shouldn't go for this, but if we can't find a way to send strings with a postmessage or sendmessage, I have no other option then to give in.
Does someone know if it can be achieved in .NET? WM_SETTEXT is capable of sending strings, so somehow it should be possible in my opinion. Also in native code (where I program in @home) this ain't a problem, and is definitely possible.
Someone any suggestions or tips?
Maybe it's just me who's stubborn, I just want to know what's best to do, and if possible know how to send strings using messages.
thanks in advance
~DP