whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

49 Visitors Online


 
...prevent your application from raising a AV with TListView under XP?
Autor: Thomas Stutz
[ Print tip ]  

Tip Rating (5):  
     


{
  The TListView with a vsReport style causes an access violation
  when you run your project with a XP manifest resource.

  The VCL wrapper has a bug and you must patch sources.
  Just copy the comctrls.pas unit in the folder with your own
  project and modify the UpdateColumn method.
  After compiling the project, a comctrls.dcu is created
  and you can replace the original comctrls.dcu with the
  patched one.

}

{
  Wenn ein XP Manifest als Ressource in eine Exe-Datei eingebunden
  wird, um einer Applikation das neue XP-Design zu verleihen,
  gibt es bei der TListView mit Style vsReport eine Zugriffsverletzung
  und die Anwenung lässt sich nicht starten.

  Das ist ein VCL Bug und kann behebt werden, indem
  comctrls.pas modifiziert wird.
  Kopiere die comctrls.pas in dein Projekte-Verzeichnis und
  ändere die UpdateColumn Methode wie folgt.
  Nach dem Kompilieren wird eine Comctrls.dcu Datei erstellt.
  Die original Comctrls.dcu kann nun durch die modifizierte ersetzt werden.
}


// ComCtrls.pas:

procedure TCustomListView.UpdateColumn(AnIndex: Integer);
{...}
with Column, Columns.Items[AnIndex] do
begin
  
{ PATCH start:}
  // mask := LVCF_TEXT or LVCF_FMT or LVCF_IMAGE;
  
mask := LVCF_TEXT or LVCF_FMT;
  if FImageIndex >= 0 then
    
mask := mask or LVCF_IMAGE;
  { PATCH :end }
  {...}
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners