
25.10.2011, 21:32
|
 |
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
В чём проблема? Вот костяк:
Код:
program Project1;
uses
Windows, Messages;
const
szAppName = 'project1';
szCaptionName = 'project1';
var
Window : HWND;
Msg : TMsg;
WndClass : TWndClassEX;
PosX, PosY : Integer;
SizeX, SizeY : Integer;
const
cctrl = 'comctl32.dll';
procedure InitCommonControls; external cctrl name 'InitCommonControls';
//---------------------------------------------------------
procedure InitApp(Wnd : HWND);
begin
end;
//---------------------------------------------------------
procedure DeInitApp(Wnd : HWND);
begin
end;
//---------------------------------------------------------
function MainProc(Wnd : HWND; Msg : Integer; wParam, lParam : Longint): Integer; stdcall;
begin
Result := 0;
case Msg of
WM_CREATE :
begin
InitApp(Wnd);
end;
WM_CLOSE :
begin
DestroyWindow(Wnd);
end;
WM_DESTROY :
begin
DeInitApp(Wnd);
PostQuitMessage(0);
Exit;
end;
end;
Result := DefWindowProc(Wnd, Msg, wParam, lParam);
end;
//---------------------------------------------------------
begin
SizeX := 300;
SizeY := 200;
PosX := 0;
PosY := 0;
FillChar(WndClass, SizeOf(TWndClassEx), 0);
WndClass.cbSize := SizeOf(TWndClassEx);
WndClass.style := CS_HREDRAW or CS_VREDRAW;
WndClass.lpfnWndProc := @MainProc;
WndClass.cbClsExtra := 0;
WndClass.cbWndExtra := 0;
WndClass.hInstance := hInstance;
WndClass.hCursor := LoadCursor(0, IDC_ARROW);
WndClass.hbrBackGround := GetSysColorBrush(COLOR_BTNFACE);
WndClass.lpszClassName := szAppName;
if RegisterClassEx(WndClass) = 0 then
Halt(255);
Window := CreateWindowEx(0, szAppName, szCaptionName,
WS_OVERLAPPEDWINDOW,
PosX, PosY, SizeX, SizeY, 0, 0, hInstance, NIL);
InitCommonControls;
ShowWindow(Window, CmdShow);
while(GetMessage(Msg, 0, 0, 0)) do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
Halt(Msg.wParam);
end.
осталось добавить кнопки.
__________________
Je venus de nulle part
55.026263 с.ш., 73.397636 в.д.
|