program Project1;
 
uses
   Windows, Messages;
  {$SETPEFLAGS IMAGE_FILE_RELOCS_STRIPPED}
 
const
  Memo_1 = 100;
 
var
  MSG: TMSG;
  WC: TWndClass;
  hWindow, Memo: HWND;
 
function WndProc(hWnd: HWND; Msg: UINT; WParam: Integer; lParam: Integer): Integer; stdcall;
begin
  Result:=0;
  case msg of
    WM_CTLCOLOREDIT:
      begin
        SetBkColor(wParam, $00);
        SetTextColor(wParam, $ffffff);
        Result:=GetStockObject(BLACK_BRUSH);
      end;
    WM_DESTROY:
      begin
        PostQuitMessage(0);
        Exit;
      end;
  Result := DefWindowProc(hWnd, Msg, WParam, LParam);
end;
 
procedure CreateWindow;
begin
  FillChar(WC, SizeOf(TWndClassEx), 0);
  WC.lpszClassName := 'Window';
  WC.lpfnWndProc := @WndProc;
  WC.hbrBackground := 1;
  WC.hCursor := LoadCursor(0, IDC_ARROW);
  RegisterClass(WC);
  hWindow := CreateWindowEx(0,
                            WC.lpszClassName,
                            nil,
                            WS_VISIBLE or WS_DLGFRAME,
                            200,300,400,200,
                            0,
                            0,
                            hInstance,
                            nil);
  Memo := CreateWindowEx(WS_EX_CLIENTEDGE,
                         'Edit',
                         nil,
                         WS_CHILD or WS_VISIBLE or WS_VSCROLL or ES_AUTOHSCROLL or ES_MULTILINE or ES_WANTRETURN,
                         10, 10, 300, 100,
                         hWindow,
                         Memo_1,
                         hInstance,
                         nil);
  sendmessage(Memo, EM_REPLACESEL, 0, longword(pchar('Сообщение: '+#13#10)));
  ShowWindow(hWindow, SW_SHOW);
  UpDateWindow(hWindow);
end;
 
begin
  CreateWindow;
  while GetMessage(MSG, 0, 0, 0) do
    begin
      TranslateMessage(MSG);
      DispatchMessage(MSG);
    end;
end.