win32 interfaces: fixed openfiledialogs on windows 98 and earlier

git-svn-id: trunk@10528 -
This commit is contained in:
vincents 2007-01-29 11:29:51 +00:00
parent edabd1fe1f
commit 711de596e8
2 changed files with 14 additions and 1 deletions

View File

@ -113,6 +113,11 @@ type
implementation
// The size of the OPENFILENAME record depends on the windows version
// In the initialization section the correct size is determined.
var
OpenFileNameSize: integer = 0;
{------------------------------------------------------------------------------
Method: GetOwnerHandle
Params: ADialog - dialog to get 'guiding parent' window handle for
@ -387,7 +392,7 @@ begin
ZeroMemory(@OpenFile, sizeof(OpenFileName));
with OpenFile Do
begin
lStructSize := sizeof(OpenFileName);
lStructSize := OpenFileNameSize;
hWndOwner := GetOwnerHandle(AOpenDialog);
hInstance := System.hInstance;
lpStrFilter := StrAlloc(Length(Filter)+1);
@ -601,6 +606,11 @@ end;
initialization
if (Win32MajorVersion=4) then
OpenFileNameSize := sizeof(OPENFILENAME_NT4)
else
OpenFileNameSize:=sizeof(OPENFILENAME);
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
@ -616,4 +626,5 @@ initialization
// RegisterWSComponent(TColorButton, TWin32WSColorButton);
RegisterWSComponent(TFontDialog, TWin32WSFontDialog);
////////////////////////////////////////////////////
end.

View File

@ -274,6 +274,8 @@ type
LPOPENFILENAME = ^OPENFILENAME;
TOPENFILENAME = OPENFILENAME;
POPENFILENAME = ^OPENFILENAME;
OPENFILENAME_NT4 = Windows.OPENFILENAME;
Implementation