06.12.2011, 11:15
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
program CreateWindowAPI;
uses
ShellAPI, Windows, Messages;
var
AWndClass: WNDCLASS;
AWnd: HWND;
AMsg: TMsg;
AppBarData: TAppBarData;
function Rect(Left, Top, Right, Bottom: Integer): TRect;
begin
Result.Left := Left;
Result.Top := Top;
Result.Bottom := Bottom;
Result.Right := Right;
end;
function WindowProc(AWnd: HWND; Msg: Integer;
wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
begin
case Msg of
WM_CREATE: begin
ZeroMemory(@AppBarData, SizeOf(TAppBarData));
AppBarData.cbSize:=SizeOf(TAppBarData);
AppBarData.hWnd:=AWnd;
AppBarData.uCallbackMessage:=WM_APP+$101;
SHAppBarMessage(ABM_NEW, AppBarData);
AppBarData.uEdge:=ABE_TOP;
AppBarData.rc:=Rect(0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
SHAppBarMessage(ABM_QUERYPOS, AppBarData);
AppBarData.rc.Bottom:=AppBarData.rc.Top+100;
SHAppBarMessage(ABM_SETPOS, AppBarData);
MoveWindow(AWnd,
AppBarData.rc.Left,
AppBarData.rc.Top,
AppBarData.rc.Right-AppBarData.rc.Left,
AppBarData.rc.Bottom-AppBarData.rc.Top, False);
Result:=0;
end;
WM_DESTROY: begin
SHAppBarMessage(ABM_REMOVE, AppBarData);
Result:=0;
end;
WM_CLOSE: begin
PostQuitMessage(0);
Result:=0;
end;
else Result:=DefWindowProc(AWnd, Msg, wParam, lParam);
end
end;
begin
AWndClass.Style:=CS_HREDRAW or CS_VREDRAW;
AWndClass.lpfnWndProc:=@WindowProc;
AWndClass.cbClsExtra:=0;
AWndClass.cbWndExtra:=0;
AWndClass.hInstance:=HInstance;
AWndClass.hIcon:=LoadIcon(0, IDI_APPLICATION);
AWndClass.hCursor:=LoadCursor(0, IDC_ARROW);
AWndClass.hbrBackground:=GetStockObject(WHITE_BRUSH);
AWndClass.lpszMenuName:=nil;
AWndClass.lpszClassName:='TWINAPIFORM';
RegisterClass(AWndClass);
AWnd:=CreateWindowEx(
WS_EX_CLIENTEDGE,
AWndClass.lpszClassName,
AWndClass.lpszClassName,
WS_VISIBLE or
WS_SYSMENU or WS_POPUP,
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT),
0, 0,
HInstance,
nil);
UpdateWindow(AWnd);
while GetMessage(AMsg, 0, 0, 0) do begin
TranslateMessage(AMsg);
DispatchMessage(AMsg);
end;
DestroyWindow(AWnd);
UnregisterClass(AWndClass.lpszClassName, HInstance);
ExitProcess(0);
end.
http://data.cod.ru/134679
__________________
Пишу программы за еду.
__________________
|