program Project1;
uses
Windows, Messages;
const
WndClass = 'TWinWnd';
WndCaption = '';
ProgBrID = 1;
PBS_MARQUEE = $08;
PBM_SETMARQUEE = WM_USER+10;
var
Wc: TWndClassEx;
Wnd: HWND;
Msg: TMsg;
ProgBr: hwnd;
function WindowProc( Wnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM ): LRESULT; stdcall;
begin
Result:=0;
case Msg of
WM_DESTROY: begin
PostQuitMessage( 0 );
Result := 0;
Exit;
end;
else
Result := DefWindowProc( Wnd, Msg, wParam, lParam );
end;
end;
begin
with Wc do
begin
cbSize := SizeOf( Wc );
style := CS_HREDRAW or CS_VREDRAW;
lpfnWndProc := @WindowProc;
cbClsExtra := 0;
cbWndExtra := 0;
hInstance := hInstance;
hIcon := LoadIcon( 0, IDI_APPLICATION );
hCursor := LoadCursor( 0, IDC_ARROW );
hbrBackground := COLOR_WINDOW;
lpszMenuName := nil;
lpszClassName := WndClass;
end;
RegisterClassEx( Wc );
Wnd := CreateWindowEx( 0, WndClass, WndCaption, WS_OVERLAPPEDWINDOW,
10, 10, 300, 100, 0, 0, hInstance, nil );
ProgBr := CreateWindowEx( WS_EX_CLIENTEDGE, 'PROGRESS_CLASS', '',
WS_VISIBLE,
10, 10, 270, 20, Wnd, ProgBrID, hInstance, nil );
SendMessage( ProgBr, WM_SETFONT, GetStockObject( ANSI_VAR_FONT ), 0 );
SetWindowLong (ProgBr, GWL_STYLE, (GetWindowLong (0, GWL_STYLE) or PBS_MARQUEE));
SendMessage(ProgBr,PBM_SETMARQUEE, 1, 50);
ShowWindow( Wnd, SW_SHOWNORMAL );
while GetMessage( Msg, 0, 0, 0 ) do
begin
TranslateMessage( Msg );
DispatchMessage( Msg );
end;
Halt( Msg.wParam );
end.