Thread View: pl.comp.demoscena
4 messages
4 total messages
Started by AinTD
Mon, 20 Dec 2004 08:57
Dlaczego WS_VISIBLE and WS_MAXIMIZED nie dziala?
Author: AinTD
Date: Mon, 20 Dec 2004 08:57
Date: Mon, 20 Dec 2004 08:57
51 lines
2196 bytes
2196 bytes
Tworze okienko ktore powinno byc zmaksymalizowane na starcie w ksiazce jest
napisane ze moge argumenty dotyczace stylu okna laczyc za pomoca OR.
I to mnie dziwi, jak operator "lub" moze dzialac jak AND ??
Jak zrobie AND to wogule mi sie okienko nie pokazuje, czemu?
Jak zrobie OR to zdaje sie ze tylko parametr pierwszy dziala, czyli
WS_VISIBLE
program Submarine;
uses
Windows,
Messages;
function WndProc(Wnd: HWND; uMsg: UINT; wPar: WPARAM; lPar:
LPARAM):LRESULT; stdcall;
begin
Result:=0;
case uMsg of
WM_DESTROY: PostQuitMessage(0);
else Result := DefWindowProc(Wnd,uMsg,wPar,lPar);
end;
end;
var
Wnd: TWndClass;
Msg: TMsg;
hWnd: THandle;
begin
with Wnd do
begin
lpfnWndProc := @WndProc;
hInstance := hInstance;
lpszClassName := 'Submarines';
hbrBackground := color_window;
end;
RegisterClass(Wnd);
hWnd:=CreateWindow('Submarines',nil{'Lodzie podwodne'}, ws_visible and
ws_maximize,
cw_usedefault,cw_usedefault,cw_usedefault,cw_usedefault,
0,0,hInstance,nil);
// showwindow(hWnd,sw_maximize);
while GetMessage(msg,0,0,0) do Dispatchmessage(msg);
end.
PS: Tworze czy moglby mnie ktos wspomoc przykladem jak powinna wygladac
petla glowna gry w api z obsluga komunikwatow w srodowisku Delphi ?
Czy jak juz zdecycowalem sie uzywac Api to juz nie bede mogl uzyc obiektu
TBitmap z delphi zeby bylo wygodniej?
Czy musze na piechote z tymi bitmapami w api sie meczyc??
Re: Dlaczego WS_VISIBLE and WS_MAXIMIZED nie dziala?
Author: poison64
Date: Mon, 20 Dec 2004 17:19
Date: Mon, 20 Dec 2004 17:19
26 lines
1700 bytes
1700 bytes
Uzytkownik "AinTD" <malborg@poczta.onet.pl> napisal w wiadomosci
news:ykosp7lxp08m$.kbsrkw4vapzg$.dlg@40tude.net...
> Tworze okienko ktore powinno byc zmaksymalizowane na starcie w ksiazce
> jest
> napisane ze moge argumenty dotyczace stylu okna laczyc za pomoca OR.
> I to mnie dziwi, jak operator "lub" moze dzialac jak AND ??
> Jak zrobie AND to wogule mi sie okienko nie pokazuje, czemu?
> Jak zrobie OR to zdaje sie ze tylko parametr pierwszy dziala, czyli
> WS_VISIBLE
AND: 1*1 = 1 pozostale 0
OR: 0+0 = 0 pozostale 1
001000
000100
010000
potraktujesz te 3 liczby OR'em i dostajesz: 011100
potraktujesz je AND'em i dostaniesz: 000000
rozumiesz?
--
Poison64
http://www.poison64.prv.pl/
Re: Dlaczego WS_VISIBLE and WS_MAXIMIZED nie dziala?
Author: AinTD
Date: Mon, 20 Dec 2004 18:13
Date: Mon, 20 Dec 2004 18:13
111 lines
3145 bytes
3145 bytes
>
> AND: 1*1 = 1 pozostale 0
> OR: 0+0 = 0 pozostale 1
>
> 001000
> 000100
> 010000
>
> potraktujesz te 3 liczby OR'em i dostajesz: 011100
> potraktujesz je AND'em i dostaniesz: 000000
>
> rozumiesz?
Rozumiem, dzieki :-)
A moglbys mi napisac petle glowna aplikacji w Delphi bo mecze sie z tym od
jakiegos czasu i nie moge zarejestrowac okienka aplikacji i nie wiem
dlaczego
unit Api_Func;
interface
uses Windows, Messages,SysUtils;
function WinMain(hInstance: HINST; hPrevInstance: HINST; lpCmdLine: PChar;
nCmdShow: integer): integer; stdcall;
function WndProc(Wnd: HWND; uMsg: UINT; wPar: WPARAM; lPar:
LPARAM):LRESULT; stdcall;
var
keys: array[0..255] of BOOL; // tablicy klawiatury
implementation
function WinMain(hInstance: HINST; hPrevInstance: HINST; lpCmdLine: PChar;
nCmdShow: integer): integer; stdcall;
var
msg: TMsg; // Komunikat
WKlas: TWndClass; // Klasa okna
WndHandle: HWND; // Uchwyt
kom1: shortstring;
kom2: pchar;
begin
with WKlas do
begin
lpfnWndProc := @WndProc;
hInstance := hInstance;
lpszClassName := 'Sub';
hbrBackground:=COLOR_WINDOW;
end;
if (RegisterClass(WKlas) = 0) then
begin
MessageBox(0, 'Wyst¹pil bl¹d podczas próby rejestracji klasy okna',
'Error', MB_OK or MB_ICONERROR);
Result := 0;
exit;
end;
WndHandle := CreateWindow(
'Sub',
'Lodzie podwodne', // Tytul programu
WS_POPUP,
0, 0, // Pozycja okna na ekranie
CW_usedefault, CW_usedefault, // Szerokosc i wysokosc okna
0,
0,
hInstance,
nil);
if (WndHandle = 0) then
begin
MessageBox(0, 'Wyst¹pil bl¹d podczas próby tworzenia okna', 'Error',
MB_OK or MB_ICONERROR);
Result := 0;
exit;
end;
ShowWindow(WndHandle, SW_SHOW);
//UpdateWindow(WndHandle);
//SetFocus(WndHandle);
while (true) do
begin
while (PeekMessage(msg, 0, 0, 0, PM_NOREMOVE)) do
begin
if (GetMessage(msg, 0, 0, 0)) then
begin
TranslateMessage(msg);
DispatchMessage(msg);
end
else
begin
Result := 1;
exit;
end;
end;
if (keys[VK_ESCAPE]) then begin;
SendMessage(WndHandle, WM_CLOSE, 0, 0);
end;
end;
end;
Re: Dlaczego WS_VISIBLE and WS_MAXIMIZED nie dziala?
Author: AinTD
Date: Mon, 20 Dec 2004 18:56
Date: Mon, 20 Dec 2004 18:56
6 lines
959 bytes
959 bytes
Zdaje sie ze znalazlem bledy i chyyyyyyyyba dojde do ladu z tym wszystkim. Dziekuje za pomoc Pozdrawiam AinTD
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads