Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005262 [JEDI VCL] 00 JVCL Components major always 2010-06-10 03:09 2011-06-10 16:10
Reporter Moritz Beutel View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0005262: NONCLIENTMETRICS size changes are not handled correctly
Description A new Vista-specific field was added to the NONCLIENTMETRICS record in
D2010. This means that SizeOf(NONCLIENTMETRICS) now yields a different
value than before - which causes SystemParametersInfo() to fail on
Win2k/XP/2003. The solution is to call the newly added
class function 'NONCLIENTMETRICS.SizeOf' instead of directly using
SizeOf().

NONCLIENTMETRICS is used throughout the JVCL, and most uses are broken
without notice. But in one instance a workaround has been applied - in
JvDockSupportProc.pas, by hard-coding the structure sizes:
// -----
  // Classic XP Era record sizes for TNONCLIENTMETRICSA or
  // TNONCLIENTMETRICSW
  {$ifdef UNICODE}
  JVDOCK_TNONCLIENTMETRICS_SZ = 500; // TNONCLIENTMETRICSW
  {$else}
  JVDOCK_TNONCLIENTMETRICS_SZ = 340; // TNONCLIENTMETRICSA
  {$endif}
// -----

I don't think this is a good idea - it's going to fail again for
Win64. I'd use this solution instead:
// -----
function JvDockGetNoNClientMetrics: TNONCLIENTMETRICS;
begin
{$IFDEF COMPILER14_UP}
  Result.cbSize := TNONCLIENTMETRICS.SizeOf;
{$ELSE}
  Result.cbSize := SizeOf(TNONCLIENTMETRICS);
{$ENDIF}
  Win32Check (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
    Result.cbSize, @Result, 0));
 end;
// -----

I've created patches (WinMerge, unified mode) which apply these fixes
to the current revision of JVCL.
Additional Information
Tags No tags attached.
Attached Files zip file icon JVCL NONCLIENTMETRICS patches.zip [^] (5,140 bytes) 2010-06-10 03:09

- Relationships

-  Notes
(0017487)
obones (administrator)
2010-06-10 16:11

Thanks, this has now been committed in SVN

- Issue History
Date Modified Username Field Change
2010-06-10 03:09 Moritz Beutel New Issue
2010-06-10 03:09 Moritz Beutel File Added: JVCL NONCLIENTMETRICS patches.zip
2010-06-10 03:10 Moritz Beutel Issue Monitored: Moritz Beutel
2010-06-10 16:11 obones Note Added: 0017487
2010-06-10 16:11 obones Status new => resolved
2010-06-10 16:11 obones Fixed in Version => Daily / SVN
2010-06-10 16:11 obones Resolution open => fixed
2010-06-10 16:11 obones Assigned To => obones
2011-06-10 16:10 obones Fixed in Version Daily / SVN => 3.40


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker