mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 12:57:14 +01:00
make code possible safer, with better typecasts and use of GlobalAddAtom, because windows are global
git-svn-id: trunk@6180 -
This commit is contained in:
parent
30062bb596
commit
67bca8d8e8
@ -1171,7 +1171,7 @@ Begin
|
||||
WM_NCDESTROY:
|
||||
begin
|
||||
// free our own data associated with window
|
||||
if Windows.RemoveProp(Window, PChar(WindowInfoAtom)) <> 0 then
|
||||
if Windows.RemoveProp(Window, PChar(dword(WindowInfoAtom))) <> 0 then
|
||||
begin
|
||||
Dispose(WindowInfo);
|
||||
WindowInfo := nil;
|
||||
@ -1430,6 +1430,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.151 2004/10/29 14:24:17 micha
|
||||
make code possible safer, with better typecasts and use of GlobalAddAtom, because windows are global
|
||||
|
||||
Revision 1.150 2004/10/29 11:00:32 micha
|
||||
fix typo: the atom var is WindowInfoAtom
|
||||
use WM_NCDESTROY, it is later than WM_DESTROY
|
||||
|
||||
@ -915,13 +915,13 @@ var
|
||||
begin
|
||||
New(WindowInfo);
|
||||
FillChar(WindowInfo^, sizeof(WindowInfo^), 0);
|
||||
Windows.SetProp(Window, PChar(WindowInfoAtom), dword(WindowInfo));
|
||||
Windows.SetProp(Window, PChar(dword(WindowInfoAtom)), dword(WindowInfo));
|
||||
Result := WindowInfo;
|
||||
end;
|
||||
|
||||
function GetWindowInfo(Window: HWND): PWindowInfo;
|
||||
begin
|
||||
Result := PWindowInfo(Windows.GetProp(Window, PChar(WindowInfoAtom)));
|
||||
Result := PWindowInfo(Windows.GetProp(Window, PChar(dword(WindowInfoAtom))));
|
||||
if Result = nil then
|
||||
Result := @DefaultWindowInfo;
|
||||
end;
|
||||
@ -934,11 +934,11 @@ end;
|
||||
initialization
|
||||
|
||||
FillChar(DefaultWindowInfo, sizeof(DefaultWindowInfo), 0);
|
||||
WindowInfoAtom := Windows.AddAtom('WindowInfo');
|
||||
WindowInfoAtom := Windows.GlobalAddAtom('WindowInfo');
|
||||
|
||||
finalization
|
||||
|
||||
DeleteAtom(WindowInfoAtom);
|
||||
Windows.GlobalDeleteAtom(WindowInfoAtom);
|
||||
WindowInfoAtom := 0;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user