delphi-2007

Writing a string to a TFileStream in Delphi 2010

烈酒焚心 提交于 2020-01-01 01:59:09
问题 I have Delphi 2007 code that looks like this: procedure WriteString(Stream: TFileStream; var SourceBuffer: PChar; s: string); begin StrPCopy(SourceBuffer,s); Stream.Write(SourceBuffer[0], StrLen(SourceBuffer)); end; I call it like this: var SourceBuffer : PChar; MyFile: TFileStream; .... SourceBuffer := StrAlloc(1024); MyFile := TFileStream.Create('MyFile.txt',fmCreate); WriteString(MyFile,SourceBuffer,'Some Text'); .... This worked in Delphi 2007, but it gives me a lot of junk characters in

How to make PBear's THtmlViewer load & show a unicode HTML file?

霸气de小男生 提交于 2019-12-30 11:37:29
问题 I have some unicode .html files that I want to display inside a THtmlViewer component, in Delphi. I can't seem to persuade the code to work just doing '.LoadFromFile' - do I firstly need to load the unicode file into a stream and then somehow convert it? Delphi 2007, THtmlViewer v9.45 I've not done anything with unicode files, or THtmlViewer, before. 回答1: FYI, THTMLViewer is actively maintained on google code (last commit couple minutes ago): http://code.google.com/p/thtmlviewer/ D6-DXE2 and

Saving a Base64 string to disk as a binary using Delphi 2007

你。 提交于 2019-12-30 07:45:53
问题 I have a Base64 binary string that is part of an XML document that is sent to us by a 3rd party supplier, I would like to be able to save it back to its original file format (jpg). Using the accepted answer from this question "saving a base64 string to disk as a binary using php" I can save the string to a jpg with little effort, so I know the string is in good form and is a JPG file. But how do I do this in Delphi 2007? Looking on the net I found a tutorial on how to convert the Base64 into

Saving a Base64 string to disk as a binary using Delphi 2007

左心房为你撑大大i 提交于 2019-12-30 07:45:19
问题 I have a Base64 binary string that is part of an XML document that is sent to us by a 3rd party supplier, I would like to be able to save it back to its original file format (jpg). Using the accepted answer from this question "saving a base64 string to disk as a binary using php" I can save the string to a jpg with little effort, so I know the string is in good form and is a JPG file. But how do I do this in Delphi 2007? Looking on the net I found a tutorial on how to convert the Base64 into

Indy 9 + Delphi 2007 latest SSL Libraries available?

血红的双手。 提交于 2019-12-30 03:29:16
问题 When using Delphi 2007 along with Indy 9, what are the latest OpenSSL libraries that can be loaded and where are they available? 回答1: You need the following two DLLs: libeay32.dll ssleay32.dll You can download the source from the open-source organization OpenSSL.org, but then you have to compile the DLLs yourself. Indy maintains a site of compiled binaries for each version of Indy and OpenSSL (see indy.fulgan.com/SSL and indy.fulgan.com/SSL/Archive -- thanks to TLama for the links). Older

Is there a benefit in using old style `object` instead of `class` in Delphi?

≯℡__Kan透↙ 提交于 2019-12-30 03:11:09
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find

Is there a benefit in using old style `object` instead of `class` in Delphi?

假装没事ソ 提交于 2019-12-30 03:11:03
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find

How to hide an application from taskbar in Windows 7?

帅比萌擦擦* 提交于 2019-12-28 13:47:10
问题 I would like to hide an application from the Windows 7 taskbar. I want to make something like a toolbar on the edge of the screen which does certain things when the user clicks on it, but I don't want it to show in the taskbar, since its a thing that i want to stay in the background. I tried the instructions in the following post, but it did not work on my application: How to hide a taskbar entry but keep the window form Then i tried it on a new empty VCL Forms Application and it still did

Initialise string function result?

元气小坏坏 提交于 2019-12-28 03:40:07
问题 I've just been debugging a problem with a function that returns a string that has got me worried. I've always assumed that the implicit Result variable for functions that return a string would be empty at the start of the function call, but the following (simplified) code produced an unexpected result: function TMyObject.GenerateInfo: string; procedure AppendInfo(const AppendStr: string); begin if(Result > '') then Result := Result + #13; Result := Result + AppendStr; end; begin if(ACondition

How is Enumerator created with for in construction destroyed?

不想你离开。 提交于 2019-12-24 05:29:23
问题 I have a collection derived from TCollection, implementing GetEnumerator so I can use it in a construction like for lElem in lCollection do The enumerator is derived from TObject, exactly like the standard enumerators supplied by Delphi and therefor doesn't have an owner. The Delphi help mentions that if the enumerator supports IDisposable is it will be disposed of, but that is for .NET only of course. What I was wondering is, how and when and by who the enumerator instance is freed? 回答1: For