delphi-2009

Abstract Class in Delphi

这一生的挚爱 提交于 2019-12-04 23:11:04
I am using a component suite which has many abstract classes. Now I want to apply polymorphism but I am getting Error Abstract Class when I create my object. Should I override all methods which are virtual even if I don't need it? Are there any workaround or solution? In order to make an instance of a class, you need to override all methods that are declared as virtual abstract. Even if you don't use them. If you really want a work around, you can use empty methods. But I won't recommend that. And to add some more information on the subject: A method is abstract if it is declared with virtual

Open an ANSI file and Save a a Unicode file using Delphi

丶灬走出姿态 提交于 2019-12-04 22:29:52
问题 For some reason, lately the *.UDL files on many of my client systems are no longer compatible as they were once saved as ANSI files, which is no longer compatible with the expected UNICODE file format. The end result is an error dialog which states "the file is not a valid compound file". What is the easiest way to programatically open these files and save as a unicode file? I know I can do this by opening each one in notepad and then saving as the same file but with the "unicode" selected in

How do I send and handle message between TService parent thread and child thread?

廉价感情. 提交于 2019-12-04 18:24:42
I am using Delphi 2010 to create a Windows service that will monitor several registry keys, and perform an action when a change occurs. I am using RegMonitorThread from delphi.about.com, and my issue is that my main service thread never receives the message that is sent from the TRegMonitorThread. type TMyService = class(TService) procedure ServiceExecute(Sender: TService); procedure ServiceShutdown(Sender: TService); procedure ServiceStart(Sender: TService; var Started: Boolean); private function main: boolean; { Private declarations } public function GetServiceController: TServiceController;

convert function to delphi 2009/2010 (unicode)

大憨熊 提交于 2019-12-04 18:24:24
I'm slowly converting my existing code into Delphi 2010 and read several of the articles on Embarcaedro web site as well as Marco Cantú whitepaper. There are still some things I haven't understood, so here are two functions to exemplify my question: function RemoveSpace(InStr: string): string; var Ans : string; I : Word; L : Word; TestChar: string[1]; begin Ans := ''; L := Length(InStr); if L > 0 then begin for I := 1 to L do begin TestChar := Copy(InStr, I, 1); if TestChar <> ' ' then Ans := Ans + TestChar; end; end; RemoveSpace := Ans; end; function ReplaceStr(const S, Srch, Replace: string)

Delphi Generic constraints problem

南楼画角 提交于 2019-12-04 17:55:05
I am trying to create a generic list class for use with tiOPF (an Object Persistence Framework for delphi @ www.tiopf.com). Specifically I am trying to take an existing generic class (TtiObjectList) and make a generic version that uses TtiObject descenants. I have limited scope for altering the base classes as they need to compile under D7 - D2009 and Free Pascal. I need to descend from TtiObjectList to keep the existing persistence mechanisms working. // base class type TtiObjectList = class(TtiObject) ... protected function GetItems(i: integer): TtiObject; virtual; procedure SetItems(i:

How to add version informations to another exes in Delphi?

只愿长相守 提交于 2019-12-04 17:54:11
I want to add version informations (for a specific language) to another exes that does not have such informations (at all). I tried with BeginUpdateResource/UpdateResource/EndUpdateResource but all I succedeed is to create "Version >> 1 >> Unknown string", not "Version >> 1 >> CompanyName/VersionNumber/Description..." and their values. I searched on Google and here but I couldn't find something useful. Only incomplete code which I didn't know how to finish. Thank you. Edit: Here is the code that I use now: procedure SetExeInfo(const ExeName, ResName, ResValue: string); var ResourceHandle:

Displaying unicode text in Rave Reports on Delphi 2009

时光怂恿深爱的人放手 提交于 2019-12-04 17:48:06
I am in the process of porting a Delphi 2006 app to Delphi 2009. Out of the box support for unicode has been easy - almost no work required. Most 3rd party controls already have Delphi 2009 updates available. Rave Reports (latest version 7.6.1, available here ) has also been updated, but I cannot seem to get it to correctly display RTF text containing Japanese characters. In Delphi 2006, I loaded RTF to the DataMemo component in a RVCustomConnection's OnGetRow event by reading the RTF from a screen control (TLMDRichEdit) using streams and then doing a CustomConnection.WriteBlobData. In the

Delphi TWebBrowser Memory Leak

爷,独闯天下 提交于 2019-12-04 16:54:36
My application uses a TWebBrowser that loads a webpage. The problem is, after closing the form containing the TWebBrowser, the memory used is not freed. If I open and close the form, the memory just keeps on increasing. Saw some post regarding calling SetProcessWorkingSetSize() or CoFreeUnusedLibrariesEx() to solve this issue, but I'm not sure if any of these are the correct solution. Any idea how to free the memory used by TWebBrowser? QC#106829 describes one possible cause of memory leaks with TWebBrowser. Accessing Document (and any other properties that are implemented via TOleControl

OpenDialog does not show up in Delphi MultiThreaded application

99封情书 提交于 2019-12-04 16:43:49
i tried to use the openDialog in new thread but it made so strange behavior .. if i put the if opendialog.execute then in the create constructor like this : constructor TChatMemberThread.Create(Name: string); begin inherited Create(True); FName := Name; FreeOnTerminate := True; Opendialog := TOpenDialog.create(nil); if opendialog.execute then for 0 to opendialog.filescount do somecodeishere end; end; the opendialog open normally but when i put it in the execute producer of the thread it didn't open at all !! i'm so beginner in threads so can any one explain for me what happened ? Thanks in

{$IFOPT A4}?

天涯浪子 提交于 2019-12-04 14:48:33
In Delphi 2009 (or older versions), how do you check the "Align" compile option in the code? The IFOPT directive seems to work only with pure switches ( {$IFOPT A4} does not compile ). I couldn't find an equivalent constant or such defined ( {$IF Align = 4} or such ) You can do this by defining a record with known packing rules and check it using SizeOf. Tested in Delphi 2009: type TTestRec = record A: Byte; B: Int64; end; {$IF SIZEOF(TTestRec) = 9} {$MESSAGE HINT '$A1'} {$ELSEIF SIZEOF(TTestRec) = 10} {$MESSAGE HINT '$A2'} {$ELSEIF SIZEOF(TTestRec) = 12} {$MESSAGE HINT '$A4'} {$ELSEIF SIZEOF