окно созданное на API(только форма без всего) исходник(2,56Кб) , .exe(9,4Кб)
|
|
Создайте текстовый файл, скопируйте в него этот текст и измените название на "APIForm.dpr"(проект делфи), потом откройте через Delphi и откомпилируйте, .exe весит 15Kб !
function APIFormC(Width, Height : Integer ) : Boolean;
var
wndClass : TWndClass; { Window class }
dwStyle , { Window styles }
dwExStyle : DWORD; { Extended window styles }
h_Instance : HINST; { Current instance }
begin
h_Instance := GetModuleHandle(nil); { Grab An Instance For Our
Window }
with wndClass do { Set up the window class }
begin
style := CS_HREDRAW or { Redraws entire window if length
changes }
CS_VREDRAW or { Redraws entire window if height
changes }
CS_OWNDC; { Unique device context for the
window }
lpfnWndProc := @WndProc; { Set the window procedure to our
func WndProc }
hInstance := h_Instance;
hCursor := LoadCursor(0, IDC_ARROW);
hbrBackground := COLOR_WINDOW; { стандартный цвет окна(можно так
445566 (RGB), или просто clred (красный) ) }
lpszClassName := 'APIForm';
end;
RegisterClass(wndClass);
dwStyle := WS_OVERLAPPEDWINDOW; { форма с кнопками вверху }
dwExStyle := WS_EX_APPWINDOW; { форма со значком приложения в углу }
h_Wnd := CreateWindowEx(dwExStyle, { Extended window styles }
function WinMain(hInstance : HINST; hPrevInstance : HINST;
lpCmdLine : PChar; nCmdShow : Integer) : Integer; stdcall;
var
msg : TMsg;
finished : Boolean;
begin
Finished := False;
APIFormC( 400, 200 ); { ширина и высота }
while not finished do
begin
if (PeekMessage(msg, 0, 0, 0, PM_REMOVE)) then { Check if there is a
message for this window }
begin
if (msg.message = WM_QUIT) then { If WM_QUIT message received
then we are done }
finished := True
else begin { Else translate and
dispatch the message to this window }
TranslateMessage(msg);
DispatchMessage(msg);
end;
end;
end;
Result := msg.wParam;
end;
begin
WinMain( hInstance, hPrevInst, CmdLine, CmdShow );
end.
|
|
|