delphi-2009

read streams line by line

假装没事ソ 提交于 2019-12-19 09:09:19
问题 Is there a way in Delphi to read streams ,line by line? Is there a way to set the encoding of the stream? I know of TEncoding.getEncodingPage(1250); How to get it from stream? 回答1: I think you're looking for TStreamReader. You set the encoding in the constructor and then call ReadLine. In terms of how to get the encoding from the stream, that depends very much on what is in the stream, doesn't it? 回答2: Delphi versions that lack TStreamReader can use Peter Below's StreamIO unit, which gives

Floating point number conversion horror, is there a way out?

末鹿安然 提交于 2019-12-18 17:37:11
问题 Background Recently my colleague add some new tests to our test project. One of them has not passed on or continuous integration system. Since we have around 800 tests and it takes an hour to run all of it, we often make a mistake and run on our dev machines only the tests which we've currently implemented. This method has its weakness because from time to time tests are passing locally but then fail on the integration system. Of course, someone could say "it is not a mistake, tests should be

Is WideString identical to String in Delphi 2009

一曲冷凌霜 提交于 2019-12-18 14:52:23
问题 I'm getting some weird behaviour recompiling some applications in 2009 that used widestrings at various points. In a Delphi 2009 App is Widestring identical to String? 回答1: No, they are not idenitical. WideString is just a wrapper for the ActiveX/COM BSTR type. You need it when working with with strings in ActiveX/COM. String in Delphi 2009 and later is an alias for UnicodeString , which can hold Unicode characters, just like BSTR does, but it's NOT the same as WideString . WideString is

Easiest way to compose Outlook 2010 mail from Delphi?

假装没事ソ 提交于 2019-12-18 13:38:33
问题 Some of our applications which work fine with different ways of email integration, using mailto: , simulated "Send To...", and SMTP in Windows 2000 and 2003 environments, now move to a new Windows 2008 system with Exchange 2010 and Outlook 2010 clients. We have one use case where the application creates a new mail, sets recipient(s) and subject, adds one or more attachments and then opens it in the default mail client so it can be edited by the user before sending. Do you know a solution

What is the best way to display a PDF file in Delphi 2009 [closed]

为君一笑 提交于 2019-12-18 13:25:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . What component should I use to display a PDF file in a Delphi 2009 application? EDIT: I have been using PDF Viewer by Synactis - a very nice free PDF Viewer But it has no Delphi 2009 support. So I need to designing it out of the product 回答1: We embedded the Acrobat Reader in our Delphi application. Take a look

When and Why Should I Use TStringBuilder?

拟墨画扇 提交于 2019-12-18 12:55:28
问题 I converted my program from Delphi 4 to Delphi 2009 a year ago, mainly to make the jump to Unicode, but also to gain the benefits of all those years of Delphi improvements. My code, of course, is therefore all legacy code. It uses short strings that have now conveniently all become long Unicode strings, and I've changed all the old ANSI functions to the new equivalent. But with Delphi 2009, they introduced the TStringBuilder class, presumably modelled after the StringBuilder class of .NET. My

Can I use a closure on an event handler (ie, TButton OnClick)

半世苍凉 提交于 2019-12-18 10:36:21
问题 If I try to use a closure on an event handler the compiler complains with : Incompatible types: "method pointer and regular procedure" which I understand.. but is there a way to use a clouser on method pointers? and how to define if can? eg : Button1.Onclick = procedure( sender : tobject ) begin ... end; Thanks! 回答1: @Button1.OnClick := pPointer(Cardinal(pPointer( procedure (sender: tObject) begin ((sender as TButton).Owner as TForm).Caption := 'Freedom to anonymous methods!' end )^ ) + $0C)^

good version control software for Delphi 2009 [closed]

喜你入骨 提交于 2019-12-18 04:48:08
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . does anyone have a good idea for what I might use ? 回答1: Its not specific to Delphi but SVN is the way to go for version control.

Best Lightweight HTML Parser for Delphi

妖精的绣舞 提交于 2019-12-18 04:14:07
问题 I need to parse out the values from some data from select boxes. Example: <option value="1">Apple</option><option value="2">Chicken</option> Usage: If option = apple then get value. Any suggestions? 回答1: DIHtmlParser? I'm not sure how "lightweight" it is, but Ralf's components always seemed to be well put together. He's also normally active and response on Embarcadero's Forums. If it's a one-off and not too complex, you could probably split on symbols manually. 回答2: Another option would be

MD5 Hashing in Delphi 2009

妖精的绣舞 提交于 2019-12-17 19:44:44
问题 In borland delphi 7 and even in delphi 2007 everything worked, but in delphi 2009 it just returns the wrong hash! I use wcrypt2 script (http://pastebin.com/m2f015cfd) Just have a look: string : "123456" hash: Delphi 7 : "e10adc3949ba59abbe56e057f20f883e" - real hash. Delphi 2007 : "e10adc3949ba59abbe56e057f20f883e" - real hash too. And... Delphi 2009 : "5fa285e1bebe0a6623e33afc04a1fbd5" - WTF?? I've tried a lot of md5 scripts, but delphi 2009 does the same with all of them. Any help? Thanks.