I haven't used delphi for a while, so there's probably a couple of errors in the syntax, but this should give you the idea...

Code:
function wsprintf(lpOut, lpFmt : PChar); cdecl; varargs;

function test(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall; begin  
  StrCopy(data,'$me');
  var me : string;
  me = SendMessage(mWnd,WM_USER + 101,0,0);
  wsprintf(data,'/.msg %s ...',me);  
  SendMessage(mWnd,WM_USER + 100,0,0);
  wsprintf(data,'/.msg %s ...',me);  
  SendMessage(mWnd,WM_USER + 100,0,0);
  Result := 2;
End;


New username: hixxy