malom
malom

Reputation: 233

Delphi 11 TShellTreeView causes access violation on Win64 platform at application startup

TShellTreeView component in Vcl.Shell.ShellCtrls unit causes an access violation in TWinControl.DefaultHandler() on Win64 platform at application startup when the form initializes.

To reproduce the bug:

  1. Create a new VCL Forms application and put a TShellTreeView component onto the form. Or, alternatively paste this minimal project source into a file named 'ShellTreeViewTest.dpr' and open the project with the Delphi IDE:

    program ShellTreeViewTest;
    uses 
      Vcl.Forms, Vcl.Controls, Vcl.Shell.ShellCtrls; 
    var 
      Form: TForm;
    begin
      Application.Initialize;
      Application.CreateForm(TForm, Form);
      with TShellTreeView.Create(Form) do
        Parent := Form;
      Application.Run;
    end.
    
  2. Then add platform "Windows 64 bit" to the project.

  3. Compile and run.

I use Delphi 11.1 Alexandria.

Upvotes: -3

Views: 406

Answers (1)

malom
malom

Reputation: 233

The AV is caused by the TCustomShellTreeView.FImages field being declared as an Integer; it is initialized by a call to SHGetFileInfo(), which returns a DWORD_PTR. Replacing FImages: Integer with FImages: DWORD_PTR solves the problem.

The TCustomShellComboBox.FImages, TCustomShellListView.FLargeImages, and TCustomShellListView.FSmallImages fields also need to be changed accordingly.

Upvotes: 0

Related Questions