PngImageList Fix for DEP and Update for D2009

Hi,

probably you already encountered the problem that your Delphi IDE crashes instantly when using the TPngImageList Thany made available years ago. This happens if you use the TPngImageList Designtime Package under systems with activated Data Execution Prevention (DEP).

Despite the fact that this problem existed for some years now Christian of the JEDI Windows API Team was the first to write about it in his blog recently.

Mitja P. added a comment which provides the source and a solution for the bug:

There is a function PatchPtr used in PngComponents unit PngImageList that needs a change of VirtualProtect to PAGE_EXECUTE_READWRITE instead of only PAGE_READWRITE if I remember correctly. I am also not sure if I reported this to the author at the time I was playing around with this components or not.

I’ve verified that this fix solves the issue for Delphi 2006 up to Delphi 2009. Thank you Mitja!

Additionally there is an updated version of the TPngImageList (created by Uwe Raabe) available at the CodeGear Repository:

PngComponents for Delphi 2009

As Delphi 2009 only integrates the PNG support into native ImageLists this updated component allows for using your already existing PngImageLists from projects prior to Delphi 2009 without any change to the images!

Please be aware that this version needs the mentioned fix as well, so update the source before installing the package.

Fix: Indy Mail Attachment Filenames lost in D2009

Hi,

probably you already discovered a bug in Indy & D2009 that when sending E-Mails with attachments you will loose the attachment filenames.

This is related to a small bug in the Indy Version shipped with the initial release of Delphi 2009. It has already been fixed in the Indy SVN.

See the QualityCentral report for it: http://qc.codegear.com/wc/qcmain.aspx?d=66867

Bug Report Background:
Without the line break fix (see below) the attachment filename is printed in the same line as “Content-Disposition” and so some mail clients ignore the filename. Without it the file will have random names regarding to the used client.

If you do not want to update the whole Indy version shipped with D2009 you can fix the bug on your own:

1) Copy the VCL source file for IdMessageClient.pas from your D2009 directory:
C:\Program Files\CodeGear\RAD Studio\6.0\source\Indy\Indy10\Protocols\IdMessageClient.pas
to your project’s directory
2) Edit the IdMesageClient.pas and change the lines given below:

procedure TIdMessageClient.SendBody(AMsg: TIdMessage):
begin
...
  if LFileName <> '' then begin
    IOHandler.WriteLn(';'); // inserted for QC 66867, between original line 1214/1215
    IOHandler.Write('        name="' + LFileName + '"'); {do not localize}
  end;
  IOHandler.WriteLn;
  IOHandler.WriteLn('Content-Transfer-Encoding: ' + LAttachment.ContentTransfer); {do not localize}
  // next line fixed for QC 66867, changed IOHandler.Write<strong>Ln</strong> to IOHandler.Write
  IOHandler.Write('Content-Disposition: ' + LAttachment.ContentDisposition); {do not localize}
  if LFileName <> '' then begin
    IOHandler.WriteLn(';'); // inserted QC 66867, line 1220/1221
    IOHandler.Write('        filename="' + LFileName + '"'); {do not localize}
  end;
...
end;

3) Save and do a full-rebuild on your project
4) Verify that IdMessageClient.dcu has been created in your project’s directory

You can also replace the existing files in the Delphi 2009 source
directory at:

C:\Program Files\CodeGear\RAD Studio\6.0\source\Indy\Indy10\Protocols\IdMessageClient.pas

If you are doing the latter, be sure to replace the DCUs at:

1) C:\Program Files\CodeGear\RAD Studio\6.0\lib\Indy10\IdMessageClient.dcu
2) C:\Program Files\CodeGear\RAD Studio\6.0\lib\debug\Indy10\IdMessageClient.dcu

You may create the needed DCUs with the earlier mentioned steps, one
time without and a second time with enabled “Build Debug DCU” option.

SpTBXLib for D2009 released

Hi,

I just saw that Robert Lee has posted a new Delphi 2009 compatible version of his GUI Library SpTBXLib a few hours ago. The new version compiles fine (currently with a small fix, see the newsgroups) using Delphi 2006 and Delphi 2009. Using the latter of course without the need to use TntUnicode anymore!

See his Download Page and for more information the SpTBXLib Release History.

Thanks, Robert!

Fix for ShellLink & Minimized Forms under < D2007

Hello,

you probably know of the tutorials Nathanial Woolls of InstallationExcellence has published some time ago regarding the Vista Issues under Delphi Versions below D2007 (available here and here).

As I’ve just checked Andreas Hausladen’s QC report #58939 which deals with the fact that Applications created by Delphi 2007 have no Taskbar Button when started minimized using the ShellLink, I’ve discovered that the same applies for anything below D2007 using the above mentioned Vista tweaks of InstallationExcellence:

You’ll receive a minimized TApplication Window on the desktop with no Taskbar Button assigned to it.

After stepping through the VCL sources of D2006 I saw that the problematic part is in TApplication.Run where CmdShow = SW_SHOWMINNOACTIVE is checked and a few lines below “Minimize;” is called.

Together with Nathanial’s fix this won’t do. To circumvent it you will have to make a small addition to his fix in order to have a correct behaviour together with minimized ShellLinks:

ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE) and not
WS_EX_APPWINDOW or WS_EX_TOOLWINDOW);
ShowWindow(Application.Handle, SW_SHOW);

// add the following lines:
if (CmdShow = SW_SHOWMINNOACTIVE) then
Application.ShowMainForm := False;

Assuming you are using Nathanial’s fix correctly in the MainForm’s OnCreate the given lines ensure that the MainForm is already hidden before Application.Run has been called.