Search code examples
windowsdelphiprivilegeswindows-messages

Windows Messages Privileges


what are the windows messages privileges?

In the Application 1, I posted a message to Application 2:

PostMessage(handle, WM_LOCAL, 0, Integer(Lst));

In the Application 2, The Message Implementation:

var l: TStringList;
begin    
  ShowMessage('got 1');
  l := TStringList(Message.LParam);
  ShowMessage('got 2');
  Memo1.Clear;
  ShowMessage('got 3');

  if Memo1 = nil then
    ShowMessage('nil');

  //HERE : Access violation.
  //Memo1.Text := l.Text;
  //ShowMessage('got 4');

  Memo1.Lines.Add('good!');
  ShowMessage('got 5');

  l.Free;      
  ShowMessage('got 6');

  //Access violation Too..
  Memo1.Repaint;
  ShowMessage('got 7');

Why this happens?

Neither i can repaint the Memo, nor Access the Text property.


Solution

  • You can not share objects between applications. Even the pointer would point to the adressspace of the destination.
    Maybe WM_COPYDATA will fit your requirements in copying data.