资源描述:
《delphi开发web程序常见问题(common problems of developing web program in delphi)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、delphi开发web程序常见问题(CommonproblemsofdevelopingwebprograminDelphi)CommonproblemsofdevelopingWebprograminDELPHI--------------------------------------------------------------------------------2004-05-27Webprogramdevelopmentpresentsagreatchallengeforthedevelopmentoftools,inthefa
2、ceofnumeroususersdemand,manycompanieslaunchedadevelopmentplatform:thedevelopmentofdesktopapplicationsandC/Sapplications,middleware,Webserver.Thisputsprogrammersinthefaceofapileoftools.DELPHIandotherdevelopmenttools,becauseitisanopensystem,aslongastheflexibleuseofsomecontro
3、ls,todevelopasystemofvarioustypes,regardlessofwhethertheNTieprogram,multi-threadedprogram,distributedcomputingprogram(includingDCOMandCORBAR),TCPprogramandWebprogram,ActiveX,middleware,pushtheprogram(Push)even,youcanuseittowriteassembler.DELPHIneatlyencapsulatesISAPI/NSAPI
4、/CGI/WCGIandsoonintoaclassthatallowsuserstogetdifferentsystemsaslongastheycompiletheresultsatcompiletime.InDELPHI4,InprisehasfurtherstrengtheneditssupportforWebprogramdevelopmenttodevelopbetterandstrongersystems.HereareafewcommonproblemsindevelopingWebapplicationsforyourre
5、ference.Ifnospecialdeclarationismade,theprogramisrununderDELPHI4.HowdoIreturnanimagefromtheWebServerApplication?WebServerApplicationnotonlygeneratescomplexpagedocuments,butalsoreturnsdifferentimagesbasedonuserrequests.Ofcourse,thereisasimplerway,dependingontheinputparamete
6、r,the"imgSRC..."flagalsopointstodifferentURLaddresses.Herewedonotusethismethod,butinsteaduseDLLtoreturntheimage.Ofcourse,firstyouhavetobuildapagecontainer(page,producer),whichreadsasfollows:"HTML""Body",This,is,a,test,BR,IMG,src=,/scripts/mydll.dll/picture,/body"/html"Next
7、,wesettheactioneventcorrespondingtothePathInfoandreturntheimageresult.Thesourcecodeisasfollows:(Note:theJPEGdeclarationisincludedinthecelldeclaration.)ProcedureTWebModule1.WebModule1WebActionItem1Action(Sender:TObject);Request:TWebRequest;Response:TWebResponse;VARHandled:B
8、oolean);VarJpgalign=left:TJpegImage;S:TMemoryStream;BeginJpgalign=left:=TJpegImage.Create