только максимизированное окно. Помогите плз...
Вот код...
- Код: Выделить всё
{$MODE OBJFPC}
{$APPTYPE GUI}
program test;
uses Windows,DirectDraw;
var
Wnd : Hwnd;
Msg : TMsg;
Wcs : PWndClassEx;
FDirectDraw : IDirectDraw7;
FPrimarySurface : IDirectDrawSurface7;
SurfaceDesc : TDDSurfaceDesc2;
hRet : HRESULT;
DC : HDC;
bltfx : TDDBLTFX;
procedure QuitMess;
begin
FPrimarySurface:= nil;
FDirectDraw:= nil;
Halt;
end;
function WindowProc(
Wndl : HWnd;
Msgl : Cardinal;
WParam, LParam: longint): longint; stdcall;
begin
result:=0;
case Msgl of
WM_DESTROY : PostQuitMessage(0)
else result:=DefWindowProc(Wndl,Msgl,WParam,LParam)
end;
if Msgl=WM_KEYDOWN then
begin
if WParam=VK_ESCAPE then
begin
QuitMess;
end;
end;
end;
begin
Wcs:=New(PWndClassEx);
Wcs^.cbSize:=SizeOf(TWndClassEx);
Wcs^.style:=CS_HREDRAW or CS_VREDRAW or CS_OWNDC;
Wcs^.lpfnWndProc:=@WindowProc;
Wcs^.cbClsExtra:=0;
Wcs^.cbWndExtra:=0;
Wcs^.hInstance:=HInstance;
Wcs^.hIcon:=LoadIcon(0,IDI_APPLICATION);
Wcs^.hbrBackground:=COLOR_BTNFACE + 1;
Wcs^.lpszMenuName:=nil;
Wcs^.lpszClassName:='main_window';
Wcs^.hIconSm:=0;
Wcs^.hCursor:=LoadCursor(0,IDC_ARROW);
RegisterClassEx(Wcs^);
dispose(Wcs);
Wnd:=CreateWindowEx(
0,
'main_window',
nil,
WS_VISIBLE,
0,0,
GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),
0,
0,
HInstance,
nil
);
UpdateWindow(Wnd);
hRet:=DirectDrawCreateEx(nil,FDirectDraw,IDirectDraw7,nil);
if hRet<>DD_OK then Halt;
FDirectDraw.SetCooperativeLevel(Wnd,DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE);
FDirectDraw.SetDisplayMode(800,600,16,0,0);
FillChar(SurfaceDesc, SizeOf(SurfaceDesc),0);
SurfaceDesc.dwSize:=SizeOf(SurfaceDesc);
SurfaceDesc.dwFlags:=DDSD_CAPS;
SurfaceDesc.ddsCaps.dwCaps:=DDSCAPS_PRIMARYSURFACE;
FDirectDraw.CreateSurface(SurfaceDesc, FPrimarySurface, nil);
while GetMessage(Msg,0,0,0) do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end.