建议用WM_COPYDATA消息,自动作空间转换:<br><br>发送方:<br>procedure SendData(const SendText: string);<br>var<br> DS: TCopyDataStruct;<br>begin<br> DS.dwData := 0;<br> DS.cbData := Length(SendText);<br> DS.lpData := @SendText[1];<br> SendMessage(FindWindow('TForm1', 'Form1'), WM_COPYDATA, 0, LongWord(@DS));<br>end;<br><br>接受方:<br>var<br> Str: string;<br>begin<br> if (MessageID = WM_COPYDATA) then<br> begin<br> SetLength(Str, PCopyDataStruct(LParam)^.cbData);<br> CopyMemory(@Str[1], PCopyDataStruct(LParam)^.lpData, PCopyDataStruct(LParam)^.cbData);<br> MessageBox(0, @Str[1],'接收到', 0);<br> end;<br>end;