Halo3 Recon – Free Wallpaper for Palm Pre

Halo3 Recon For Palm PreI’m an avid Halo3 fan, and take my games seriously. So if you are a Halo3 gamer but haven’t been able to find the time or right mix of team mates to help you get it, BUT you do have a Palm Pre or other SmartPhone, here is a nice little free Halo3 wallpaper featuring recon armor. Makes you salivate for Halo Reach… I KNOW!

Posted in Free Stuff | Tagged , , , , , | Leave a comment

Crystal Reports Delivered (via Delphi Isapi Webserver Application)

Well obviously, you may have tried to use the Crystal Reports VCL component inside a Delphi ISAPI webserver application, and crashed and burned repeatedly. It took my a long time to properly integrate Crystal reports inside an Isapi application with Borland / CodeGear Delphi. After literally weeks of research in 2004 I was able to properly utilize almost all of Crystal’s functionality inside an ISAPI.

Why am I just now writing about this? Well… As time rolls on, the technology is still very viable. Especially if you have a ton of Crystal reports you’d like your users to be able to download in .Doc or .PDF, or other printer friendly formats. Crystal Reports is a great reporting tool, and Isapi is a great, fast web serving technology.

Here Goes…
Import the Crystal Reports type library, save it as CRAXDRT_TLB; (into new unit) This would apply to Crystal Reports version 9. Don’t forget to add the “cr” in front of all of the import units object names, because they will try to replace Delphi existing types!!!

Here’s the source code example: Please forgive any poor formatting on my part I wrote an automated .Pas to HTML conversion program, in about ten minutes, and right now it’s imperfect. So I will work on that program as I continue to post Delphi Tips. Thanks and enjoy.

PLEASE LEAVE ME A COMMENT IF YOU LIKE!

———————————————————————————
procedure TWebModule1.WebModule1WaExportReportAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var CrReport : Report;
NewStream : TStream;
TheReportType :CRExportFormatType;
S, TheCType : String;
begin
try

//For Initilization purposes only

TheReportType:= CRAXDRT_TLB.crEFTPortableDocFormat;

//End Initialization

////Use the value of a web page radio button to determine the type of export ////the users desires.

if TheButtonVal=‘PDF’ then begin
TheReportType:= CRAXDRT_TLB.crEFTPortableDocFormat;
TheCType:=‘application/pdf’
end;
if TheButtonVal=‘DOC’ then begin
TheReportType:= CRAXDRT_TLB.crEFTWordForWindows;
TheCType:=‘application/doc’
end;
if TheButtonVal=‘XLS’ then begin
TheReportType:= CRAXDRT_TLB.crEFTExcel80;
TheCType:=‘application/xls’
end;
if TheButtonVal=‘RTF’ then begin
TheReportType:= CRAXDRT_TLB.crEFTExactRichText;
TheCType:=‘application/rtf’
end;

///You could use the actual report name added to a select element using ///Delphi’s ///FindFiles…
CrReport := Application1.OpenReport(‘DirectoryName\’+TheReportName);

CrReport.DiscardSavedData;
CrReport.EnableParameterPrompting:=False;
CrReport.DisplayProgressDialog:=False;
if TheButtonVal=‘PDF’ then
CrReport.ExportOptions.PDFExportAllPages;

if CrReport.ParameterFields.Count=1 then
CrReport.ParameterFields.Item[1].AddCurrentValue(Code1);
////Depending upon any parameter values the Report uses and how they are //configured, these lines could change.
if CrReport.ParameterFields.Count=2 then begin
CrReport.ParameterFields.Item[1].AddCurrentValue(Code2);
CrReport.ParameterFields.Item[2].AddCurrentValue(Code3);
end;
CrReport.ExportOptions.FormatType :=TheReportType ;
CrReport.ExportOptions.DestinationType :=CRAXDRT_TLB.crEDTDiskFile;

/////Give the created report a destination on disk, and name
CrReport.ExportOptions.DiskFileName :=

CrReport.Export(False);

NewStream:=TFileStream.Create(the name you created above),
fmOpenRead and fmShareDenyWrite);
Response.ContentStream:=NewStream;
//IMPORTANT
Response.ContentType:=TheCType;
Response.SetCustomHeader(‘content-disposition’, ‘attachment; filename=YourShortFileName));
except
Response.SendRedirect(‘Your Error Handling Page’)
end;
end;
———————————————————————————

Posted in Delphi Tips & Code | Leave a comment

Bold Nodes in TtreeView – Delphi Example

Bold Nodes in TTREEVIEW

Delphi Tip (One of My Favorites)

You know the problem. As a software programmer you might not care, but as a software designer, the standard Microsoft Windows controls are plain and boring… Especially the standard old Windows Tree View control as wrapped by Delphi! Windows Vista glitzed them up a little, adding a nice graduated bitmap. However, sometime you need to draw emphasis to a control node, a parent node, a child node, or some other type of tree node. Here’s a quick fix!

———————————————————————————
uses CommCtrl;

procedure SetNodeBoldState(Node: TTreeNode; Value: Boolean);
var
TVItem: TTVItem;
begin
if not Assigned(Node) then Exit;
with TVItem do
begin
mask := TVIF_STATE or TVIF_HANDLE;
hItem := Node.ItemId;
stateMask := TVIS_BOLD;
if Value then state := TVIS_BOLD
else
state := 0;
TreeView_SetItem(Node.Handle, TVItem);
end;
end;

//Suggested Usage
//Bold nodes of first and last node in a treeview.
SetNodeBoldState(TreeView1.Items[0], True);
SetNodeBoldState(TreeView1.Items[TreeView1.Items.Count-1], True);

//Set all parent node what have children to bold.
var: I Integer;
begin
for I := 0 to TreeView1.Items.Count - 1 do
if TreeView1.Items[I].HasChildren then
SetNodeBoldState(TreeView1.Items[I]);

//Set Node to bold based on level.

var: I Integer;
begin
for I := 0 to TreeView1.Items.Count - 1 do
if TreeView1.Items[I].Level >= 2 then
SetNodeBoldState(TreeView1.Items[I]);
———————————————————————————

Posted in Delphi Tips & Code | Leave a comment