I have found that EVERY Delphi application will exhibit this bug with
a OpenDialog and CloseDialog (at least Delphi 4-6). It appears that
this bug was introduced with WindowsXP SP2, and I am not sure if it
exists in Vista. However, here is a simple fix for this problem... You
only need to add this modification to the first form of your
application:
uses ActiveX;
initialization
OleInitialize(nil);
finalization
OleUninitialize
end.
On Dec 7, 11:39 am, crlab <chrisror...@[EMAIL PROTECTED]
> wrote:
> Hello-
>
> I have found the following bug with Delphi versions 4, 6 and 7 (at
> least) running on Windows XP2 (service pack 2). In general, I found
> that Delphi OpenDialog boxes occasionally crash when the user looks
> around the desktop. Below I illustrate a way to see this behavior 100%
> of the time. I have seen identical performance on three machines (2
> are 32-bit, one has XP 64-bit).
>
> To elicit the bug:
> 1.) Show the TOpendialog (opendialog1.execute)
> 2.) Select an item on the desktop.
> 3.) Wait for a tooltip to appear.
> 4.) Press 'Cancel'
> 5.) Show the TOpendialog (opendialog1.execute)
> 6.) Select an item on the desktop.
> 7.) Wait for a tooltip to appear.
> -- at this point the program crashes.
>
> By the way, notepad.exe shows the same behavior on Windows XP SP2 32-
> bit - so this is not a Delphi specific bug, but I would love to find a
> work-around.
>
> Further, making the program an exception for Window's DEP does not
> resolve the problem (to turn DEP on or off for a program, go to Start/
> Settings/ControlPanl/System, advanced tab, 'settings' button on the
> performance panel, then select the 'Data Execution Prevention' tab.
>
> -chris
>
> -----------------------
> unit Unit1;
>
> interface
>
> uses
> Windows, Messages, SysUtils, Variants, Cl*****, Graphics, Controls,
> Forms,
> Dialogs, StdCtrls;
>
> type
> TForm1 = class(TForm)
> Button1: TButton;
> OpenDialog1: TOpenDialog;
> procedure Button1Click(Sender: TObject);
> private
> { Private declarations }
> public
> { Public declarations }
> end;
>
> var
> Form1: TForm1;
>
> implementation
>
> {$R *.dfm}
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> opendialog1.execute;
> end;
>
> end.


|