{$MODE DELPHI} {$APPTYPE GUI} uses Windows; var Msg: TMsg; Main: HWnd; Title: String; WideTitle: WideString; WSM: TWideStringManager; {Мозг} function WndProc(Wnd: HWnd; Msg: Cardinal; wParam,lParam: LongInt): LongInt; Stdcall; begin result := 0; case Msg of WM_DESTROY: PostQuitMessage (0); else result := DefWindowProc (Wnd,Msg,wParam,lParam); end; end; {Класс окна} function WinReg: Boolean; var WndClass: TWndClass; begin with WndClass do begin Style := CS_HREDRAW or CS_VREDRAW; lpfnWndProc := @WndProc; cbWndExtra := 0; cbClsExtra := 0; HInstance := System.MainInstance; HIcon := LoadIcon(0,IDI_APPLICATION); HCursor := LoadCursor(0,IDC_ARROW); HbrBackground := COLOR_BTNFACE + 1; lpszMenuName := nil; lpszClassName := 'MAIN'; end; result := RegisterClass (WndClass) <> 0; end; {Главное окно} function MainFn: HWnd; var Wnd: HWnd; begin Wnd := CreateWindowEx (0,'MAIN','Default', WS_OVERLAPPEDWINDOW or WS_VISIBLE, CW_USEDEFAULT,CW_USEDEFAULT, 200, 200, 0, 0, HInstance, nil); ShowWindow (Wnd,SW_SHOW); UpdateWindow (Wnd); result := Wnd; end; begin if not WinReg then begin MessageBox (0,'Class wasn''t registered. Press OK to quit','Error',MB_OK); exit; end; Title := 'АБВ'; WSM.Ansi2WideMoveProc (@Title,WideTitle,4); Main := MainFn; SendMessage (Main,WM_SETTEXT,0,LParam (WideTitle)); while GetMessage (Msg,0,0,0) do begin TranslateMessage (Msg); DispatchMessage (Msg); end; end.