[Lazarus] SendMessage Bug Work Around.

Justin Smyth delphian at smythconsulting.net
Thu Apr 22 14:43:04 CEST 2010


I dont know if many of you guys who use win32 are aware of a bug / 
limitation of sendmessage in windows , when you are trying to send a message 
to another application , when the message gets there both lparam and wparam 
are invalid ( or pointing to rubish ) ( i also got the same issue on 
SimpleIPC on win32 to the same result when you try to send data with the 
message - as it uses sendmessage to do the low level work - i think !! )

with in the same application it seems to work , but when you use more than 
one application together or one application sending a message to a prev 
instance of the application ( ie you run it for the second time , the second 
copy is sending a message to the first copy ).

the best work around i've found is to use a NamedPipe which i know is win32 
only ( not sure about other os's ) , i basically created a "ServerPipe" and 
a "ClientPipe" and use this pipe to send info from the second application 
back to my main application to get around the sendmessage issue.

I know alot of you guys are not using win32 but other variants of linux but 
for the people who are using win32 this maybe of interest if you have got 
issues with SendMessage on win32.

My Os is Win7 RTM on one pc and Win7 Retail on the other - both ultimate 64 
bit. & i am using pritty much the lastest SVN

i also suspect this method may help anyone using a DLL who needs to pass 
objects back and forth ( i think havent tested but i think it should be 
feasable.. )

if any one is interest in the code for this issue feel free to ask , i''m 
happy to share it.

A big thanks to Paul Ishenin , for all your help , your hardwork has help me 
in getting the last bit of my application over from delphi 2010 to Lazarus 
x64.


Cheers

Justin Smyth

AKA

Delphian






More information about the Lazarus mailing list