forked from jrsoftware/issrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VCL-Controls-D2D5-patch.txt
48 lines (38 loc) · 1.39 KB
/
VCL-Controls-D2D5-patch.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
This patch to Delphi 2.01-5.01's Controls.pas fixes an AV issue with
combo boxes and Outlook Express; see:
http://groups.google.com/group/borland.public.delphi.vcl.components.using/browse_thread/thread/e012cea3ea1d258b
Delphi 6 has the same problem, but needs a slightly different patch --
see VCL-Controls-D6-patch.txt.
Delphi 7 and later already incorporate an equivalent fix.
After applying the changes, recompile Controls.pas from the command
line as follows:
> c:\delphi\bin\dcc32 -$D- -$L- Controls.pas
> move Controls.dcu c:\delphi\lib
--- Controls.pas.orig Sun Jun 09 03:01:00 1996
+++ Controls.pas Tue Mar 19 20:45:04 2002
@@ -967,11 +967,15 @@
{ Find a TWinControl given a window handle }
function FindControl(Handle: HWnd): TWinControl;
+var
+ PID: DWORD;
begin
Result := nil;
if Handle <> 0 then
begin
- Result := Pointer(GetProp(Handle, MakeIntAtom(ControlAtom)));
+ if (GetWindowThreadProcessId(Handle, @PID) <> 0) and
+ (PID = GetCurrentProcessId) then
+ Result := Pointer(GetProp(Handle, MakeIntAtom(ControlAtom)));
end;
end;
@@ -1271,8 +1275,12 @@
end;
function IsDelphiHandle(Handle: HWND): Boolean;
+var
+ PID: DWORD;
begin
Result := (Handle <> 0) and
+ (GetWindowThreadProcessId(Handle, @PID) <> 0) and
+ (PID = GetCurrentProcessId) and
(GetProp(Handle, MakeIntAtom(WindowAtom)) <> 0);
end;