win32 interface: fixed several range errors

* create app window without caption, so that GetWindowSize doesn't return a negative size
* prevent usage of uninitialized array similar to r10798 #eaf391320b

git-svn-id: trunk@10810 -
This commit is contained in:
vincents 2007-03-26 19:02:29 +00:00
parent 4bc63f785d
commit 8ac2f8b036
3 changed files with 8 additions and 4 deletions

View File

@ -448,7 +448,7 @@ Var
// send through message to allow message override
//lWinControl.EraseBackground(PaintMsg.DC);
Include(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground);
lWinControl.Perform(LM_ERASEBKGND, PaintMsg.DC, 0);
lWinControl.Perform(LM_ERASEBKGND, Windows.WPARAM(PaintMsg.DC), 0);
Exclude(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground);
end;
if ParentPaintWindow <> 0 then

View File

@ -175,7 +175,7 @@ begin
// Create parent of all windows, `button on taskbar'
FAppHandle := CreateWindow(@ClsName, PChar(Application.Title), WS_POPUP or
WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
WS_CLIPSIBLINGS or WS_SYSMENU or WS_MINIMIZEBOX,
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
@ -400,6 +400,7 @@ end;
procedure TWin32WidgetSet.AppWaitMessage;
var
timeout: dword;
pHandles: Windows.LPHANDLE;
begin
RedrawMenus;
Assert(False, 'Trace:TWin32WidgetSet.WaitMessage - Start');
@ -407,7 +408,10 @@ begin
timeout := 100
else
timeout := INFINITE;
Windows.MsgWaitForMultipleObjects(FWaitHandleCount, FWaitHandles[0],
pHandles := nil;
if FWaitHandleCount > 0 then
pHandles := @FWaitHandles[0];
Windows.MsgWaitForMultipleObjects(FWaitHandleCount, pHandles,
false, timeout, QS_ALLINPUT);
Assert(False,'Trace:Leave wait message');
End;

View File

@ -145,7 +145,7 @@ var
MoveWindowOrgEx(PaintMsg.DC,-ClientBoundRect.Left,-ClientBoundRect.Top);
try
// call win32 paint handler
CallDefaultWindowProc(Handle, WM_PAINT, PaintMsg.DC, 0);
CallDefaultWindowProc(Handle, WM_PAINT, WPARAM(PaintMsg.DC), 0);
finally
// restore DC origin
MoveWindowOrgEx(PaintMsg.DC, ClientBoundRect.Left, ClientBoundRect.Top);