delphi-2006

Delphi - Application independent of Regional Settings

一世执手 提交于 2020-01-01 07:01:41
问题 I need to make an application(D2006) independent of Regional Settings, most important all the dateformats must be the same. For the begging I want to replace all the FormatDateTime('adateformate') with FormatDateTime('aConstantDefined'). Also Application.UpdateFormatSettings and Application.UpdateMetricSettings should be set to False. Is there anything else I should make/take care? LE: problem is that I have users with 2 different Regional Settings, and they don't want to uniform their

Background Worker Delphi

为君一笑 提交于 2019-12-31 06:59:27
问题 I would like to prepare asynchronous process for procedure in Delphi Borland 2006 do you know how? application.ProcessMessages; dm001.Proc.Close; dm001.Proc.Parameters.Clear; dm001.Proc.ProcedureName:='[dbo].[EXAMPLE]'; dm001.Proc.Parameters.AddParameter.Name:='@idEXAMPLE'; dm001.Proc.Parameters.ParamByName('@id').DataType:="example"; dm001.Proc.Parameters.ParamByName('@id').Value:="example"; dm001.Proc.Open; Example in C# private void bw_DoWork(object sender, DoWorkEventArgs e) {

Fast way to split a string into fixed-length parts in Delphi

江枫思渺然 提交于 2019-12-31 00:31:07
问题 I need to split a string to a TStringList with fixed-length sub-strings. Currently I use: procedure StrToStringList(ASource: string; AList: TStrings; AFixedLen: Integer); begin Assert(Assigned(AList)); while Length(ASource) > AFixedLen do begin AList.Add(LeftStr(ASource, AFixedLen)); Delete(ASource, 1, AFixedLen); end; AList.Add(ASource); end; This works, but seems to be slow. Any better / faster idea? Edited: Profiling of the results : The speed gain is quite impressive. Here are the results

How to auto fit/scale DBGrid's (or other similar) columns widths according to its contents?

烂漫一生 提交于 2019-12-30 06:13:11
问题 I am trying to make a frame with a DBGrid that will serve for more than 10 tables with half of its fields as defaults, and other fields exclusive for each table. As the space for the columns are limited and I do not want to configure each column of each table manually because it is very poor quality work, I was wondering a way to calculate the width of each column by the largest content of a row inside that column, measured by the own component or by the data set. Does anyone knows the way?

Delphi 2010 Cryptography libraries [closed]

心不动则不痛 提交于 2019-12-30 04:47:08
问题 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 3 years ago . can you recommend an open source Delphi crypto library that works with Delphi 2006, Delphi 2009 & Delphi 2010 Algorithms need : DES, MD5, SHA-1 回答1: Here is a short list of the libraries I have used both pre and post D2009: TPLockbox (I use an unofficial updated version. Although there is a recent official(?)

What's a simple way of programmatically simulating user input?

不想你离开。 提交于 2019-12-23 12:18:42
问题 I have a dialog that pops up as result of an error condition. I want the dialog to remain open for at least 30 seconds, and close 30 seconds after the last user input (mouse or keyboard) is received. I can implement this by checking the value returned by GetLastInputInfo and closing the dialog when this is more than 30 seconds ago, but if the dialog pops up when the user hasn't been at the mouse or keyboard for 30 seconds, the GetLastInputInfo test passes immediately, and the dialog closes

How to Set a Value to a Sub-Property Item using TypInfo RTTI Methods?

纵饮孤独 提交于 2019-12-22 09:38:47
问题 In my Question: How to use “Sender” parameter with “As” operator for more then one class at a time I choose the Remy Lebeau's Answer because it was the most dynamic tech for most situations like that. It uses the RTTI TypInfo Class. But as I was using this class, another problem came: How do we Set a sub-property value? function TRemote.UpdateQuery(DataSet: TDataSet; SQL: String): Boolean; var PropInfo: PPropInfo; begin { atualiza o código SQL padrão de um dataSet de consulta tipo View }

How to get a list from all opened forms of my software?

自闭症网瘾萝莉.ら 提交于 2019-12-22 05:40:06
问题 I want to ask the user to close all opened forms before terminate my application. How can I automatically get a list from opened forms? I'm using Delphi 2006, and don't using form's Auto-Create, but I'm using the auto created form's referenced var with Application.CreateForm . My regards. 回答1: Have a look at Screen.FormCount and Screen.Forms. 回答2: A possible solution (I use in C#) is to store every opened form instance in a list var. For example you could have a global list named openedForms

A quick way to remove properties from .dfm files in Delphi

房东的猫 提交于 2019-12-22 04:28:13
问题 I have recently modified one of my components, and it so happens it is no longer using one of the properties it used before. However, those properties are written in multiple .dfm files throughout the project. Now, when i try to compile the project, i get "Error reading .: Property <...> does not exist" The complicated part is that the property value is binary data (stored in multiple lines), and i cant just delete it with Delphi replace or notepad++ regexp (since they are single-line based).

What's the most CPU-efficient way to “waste time” in a thread?

杀马特。学长 韩版系。学妹 提交于 2019-12-21 07:38:53
问题 I have a number of threads (100's) that each execute for a few seconds at a time. When they are executing, they spend a significant amount of that time waiting for a response from another system (a serial device). I am mindful that having 100 threads executing at once could be a resource hog so I actually limit the number of threads that can start at any one time. It occurs to me though that there must be good and bad ways of waiting for an external event inside a thread. Is this approach CPU