DirectSkin access violation

Hi,

I am testing your DirectSkin activeX (wbocx.ocx) with Delphi 2010 but I have an access violation when I close the program.

The skin is loaded and applied to the window properly but after closing the main frame the error message "access violation " appears.

Any idea?

The code is very simple :

unit Demo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, WBOCXLib_TLB, OleCtrls;

type
  TMainForm = class(TForm)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    Exit1: TMenuItem;
    Skin1: TMenuItem;
    MacPC1: TMenuItem;
    SigmaShadows1: TMenuItem;
    MerlinEni1: TMenuItem;
    Wbocx1: TWbocx;
    procedure FormCreate(Sender: TObject);
    procedure Exit1Click(Sender: TObject);

  const SkinsFolder = 'C:\Program Files\Stardock\DirectSkin\samples\skins';
        DogmaSkinFile = 'dogmax\dogmax.uis';

  private
    DirectSkinLoaded : Boolean;

  public
    { Déclarations publiques }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.FormCreate(Sender: TObject);

var
    loadSkinError : Smallint;

begin

     { Change to the skin sample directory }
     Wbocx1.SetRootPathStr (SkinsFolder);

     { Set the skin }
     loadSkinError := Wbocx1.LoadUIS (DogmaSkinFile);

     if loadSkinError = 0 then
     begin
        { Init the ocx - allocates memory, loads skin etc }
        DirectSkinLoaded := Wbocx1.InitWB ();

        { Apply the skin }
        Wbocx1.DoWindow (0);

     end;
end;

procedure TMainForm.Exit1Click(Sender: TObject);
begin
  Application.Terminate;
end;

end.

Thank you in advance!

2,336 views 7 replies
Reply #1 Top

If you have a technical question, please contact [email protected].

Reply #2 Top

Calling SetVersionExpected (119) may help (before DoWindow), or perhaps also adding SetVersionExpected (127)

Reply #3 Top

Hi,

After comparing the Delphi sample project to my program under Delphi 2010, I noticed a difference in the source code of the Delphi 2010 project. Since Delphi 2007, there is a new property to TApplication called MainFormOnTaskBar. It defaults to True for new Delphi 2007 applications and False for existing ones.

program DirectSkinDemo;

uses
  Forms,
  Demo in 'Demo.pas' {MainForm};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TMainForm, MainForm);
  Application.Run;
end.

The MainFormOnTaskBar property controls how Windows taskbar buttons are handled by VCL. If the property is true, a taskbar button represents the application's main form and displays its caption. If false, a taskbar button represents the application's main window and bears the application's Title. Also it must be true to use Windows Vista Aero effects. These include live taskbar thumbnails, Dynamic Windows, Windows Flip, and Windows Flip 3D...

So I set MainFormOnTaskbar to false to resolve this bug. But what a pity for those with Vista who use the Aero effects...

Reply #5 Top

Hi Banfield,

No change with SetVersionExpected (119) and SetVersionExpected (127).

 

Reply #6 Top

If you can provide us with an app that uses the DS demo and has the crash we can investigate it and see what can be done to resolve it.

Reply #7 Top

Hi Neil,

That sounds good! I did a simple project with RAD Studio Delphi that I can provide you. I send the zipped file to technical support?