DelphiUdIT
Members-
Content Count
611 -
Joined
-
Last visited
-
Days Won
11
Everything posted by DelphiUdIT
-
EDIT: The answer is very "basic", I don't think I fully understand what you are asking ... I think it refers to differences from other languages where an "array" is automatically created in certain cases. In Pascal every object, variable, type or other must be known and defined before use. So in your case, knowing that you will have more "strings" to use you must predict their use using for example these solutions (there can be a thousand others that can be created, but these are some of those that the language and the predefined types handle natively, except for database that is another kind of container): Here same ref: https://docwiki.embarcadero.com/RADStudio/Athens/en/Structured_Types_(Delphi)#Arrays 1) static arrays; 2) dynamic arrays; 3) Lists; 4) Collections; 5) Dictionary; 6) Generics array; 7) .... 1) Static arrays are arrays with a predefined and immutable length, they are defined at compiler time and are fine when you know how long your list is at most. //This array contains 1000 strings (i.e. for example a thousand names) var myarray: array [0..999] of string; i: integer; myarray[0] := ' Mario'; myarray[1] := ' Maria'; //loop through the entire array for i:= Low(myarray) to High(myarray) do ShowMessage(myarray[i]); 2) Dynamic arrays: they are defined at compiler time (with the number of elements predefined at 0) and can be changed at runtime. var myarray: array of string; s: string; //Creates space for a thousand strings //I can change this number whenever I need it during the program, either increasing or decreasing it SetLength(myarray, 1000); myarray[0] := ' Mario'; myarray[1] := ' Maria'; //loop through the entire array, you can also use the same syntax with for //as for the static array. for s in myarray do ShowMessage(s); ........ ........ //At the end of the use, the space must be returned by setting the length to zero SetLength(myarray, 0); 3) and 4) and 5) They are specialized "containers": https://docwiki.embarcadero.com/Libraries/Athens/en/System.Generics.Collections 6) Generics can contain any "thing", in this example I show you the use with strings: var myarray: TArray<string>; s: string; //Create space for a thousand strings //I can vary this number whenever I need it during the program, both increasing and decreasing it SetLength(myarray, 1000); myarray[0] := ' Mario'; myarray[1] := ' Maria'; //loop through the entire array, you can also use the same syntax with for //as for the static array. for s in myarray do ShowMessage(s); ....... ....... //At the end of the use, the space must be returned by setting the length to zero SetLength(myarray, 0); 7) ... you can create your own array, for example with adavanced record: type //Really simple example TAnag = record private fName: string; fAge: integer; public property Age: integer read fAge write fAge; property Name: string read fName write fName; end; var Anag: TArray<TAnag>; s: TAnag; SetLength(Anag, 1000); Anag[0].Name := 'Mario'; Anag[0].Age := 21; Anag[1].Name := 'Maria'; Anag[1].Age := 18; //loop through the entire array, you can also use the same syntax with for //as for the static array. for s in Anag do ShowMessage(s.Name); ....... ....... //At the end of the use, the space must be returned by setting the length to zero SetLength(Anag, 0); A lot of functions in standard library return an array of object, like strings, integers of doubles. In this case you can assign to an empty generic or dynamic array the result ... automatically the array will be resized. Remeber to free it after used, example; var Data: TArray<string>; Combo: TComboBox; .... .... Data := Combo.Items.ToStringArray; ..... ..... SetLength(Data, 0);
-
In this post, Ian Barker reply about compatibility of 12.2 Patch 1: https://blogs.embarcadero.com/rad-studio-12-2-athens-inline-patch-1-available/#comment-11544
-
May be you should use 'I' and 'i' (case sensitive) in the events ?
-
May be I'm wrong, but the e-mail should go to support if you have an active subsricription otherwise sales ... I undesrtood weird ? In the past I asked to support to bump the number.
-
May be you have only expired the number of installation allowed (I think they are 3). Send an e-mail to customer service in Embarcadero and ask to higher that.
-
That is not true, May be the BPLs are compatible with old version (so the design component are OK), but the DCU are not. Try to compile a project, the new version say that some DCU (64 bit) use a different "System.xxx.xxx" version and of course they don't link together. I must recompile, and for "security", rebuild all components (Design and Runtime).
-
I don't think you can do something, except to capture the keyboard in the control (or in the OnKey... of the Form with the KeyPreview property active). In the event intercept the combination key and put tha value to ZERO (0). Take care that you must try wich event you can use ... not all the OnKey... events are the same scope. Edit: you can see an example how to implement the OnKeyDown event in a TControl descendent here: https://docwiki.embarcadero.com/RADStudio/Athens/en/Responding_to_Key-down_Messages Bye
-
All the CCR realted files should be in the project directory, or you must add the path lib where these files are located (in the project options or in the tool/language/ Delphi options). If the CCR is a standalone project group (runtime o designtime) you must build it after the changes (and the path that you should use is the path where the CCR project group save the DCU files). If the CCR is only a set of Pascal source, your path lib must be the path where the sources are located. Bye
-
I have no notice about that. ".Net" have the same problems like all other development tool, they update their tools also for resolve bugs. But many times is the human works that induce the problems, not the language or the development tool.
-
The memory of your program is private and not others applications can normally access it (some Microsoft tools will be able to do this, like some antivirus). So if the memory were corrupt over the time normally it is the application itself that is the cause of it. Take care that your application use all kind of Microsoft (like in all other OS) services, DLL and driver. May be that those are some bugs (need to maintain update the environment like OS, drivers ...). P.S: but if you go to Windows event log like I told you can see something.
-
Service monitoring other services activities
DelphiUdIT replied to Clément's topic in Algorithms, Data Structures and Class Design
I did something similar many years ago, then I abandoned this path because all the problems were solved and there was no longer any need for a similar approach. What I did was use a program external to the application (not a service) using it as a "dumb" TCP server to collect information from all the other applications and their threads. The reception had to have updated data (for example the number of cycles performed, the status of the connections, the number of polling performed on all devices) and through a rough analysis performed by this external application on which the TCP server ran, any alerts were displayed. At the time I also took into account the revolutions that an encoder performed (an encoder is a device that counts the rotations of a mechanical shaft) to match it with the cycles performed and if they did not match then alarms were sent from all sides (it cannot be said, but the application sent the data privately via its own internal mail client connected to my company server so that we had everything under control, similar to "analitycs"). -
Like all electronic devices, memory, processor, motherboard, SSD and everything else can fail, generating the most varied errors. Generally, the failures essentially depend on either electrical failures caused by overvoltage or similar situations or failures related to overheating (for example in the case of overclocking and inadequate ventilation). Obviously we are talking about normal Home PCs, because if we are talking about systems (for example industrial or commercial) then the case history is much more extensive. If you have a latest generation Intel processor (13th or 14th) and above all if you have tried to overclock it, it is possible that the processor is failing (see Intel's note ... now they have solved the problem but this anomaly has lasted until now ... the link is no longer active). AV can also be generated by failures of the SSD that reports incorrect data to the application. However, if you go to the Windows event log you can take a look ... normally the anomalies are reported there ...
-
Calling a VB6 ActiveX from Delphi 11.3
DelphiUdIT replied to The Code Captain's topic in General Help
Tihs article explains something .... the $1332 value was a predefined default value on some old Delphi editions .... may be before Delphi 12 in wich they change the standard mask of FPU exception. I don't know if this is a casuality about the standard VB setting needed to work, but ... EDIT: https://stackoverflow.com/questions/39684161/why-an-application-starts-with-fpu-control-word-different-than-default8087cw -
Calling a VB6 ActiveX from Delphi 11.3
DelphiUdIT replied to The Code Captain's topic in General Help
I used in the far past this setting (only one time, at the begin of Delphi program, or better in the thread where the ActiveX is instantiated) before calling any MS ActiveX: Set8087CW($27f); Hope this help. -
Normally I always use SQLite as a base for all my applications (configurations, settings and more are kept inside). Then depending on the customer, additional databases such as MSSql, MySql, Firebird are used in addition, but with the server managed by the customer. However, the use of databases in addition to SQLite is sporadic, many customers want to have the data in an open format of pure text such as a CSV file.
-
OutOfRange Error with TComboEdit in Delphi FMX
DelphiUdIT replied to kidego9436's topic in Cross-platform
The first Item of a list (ITEMS -> ItemIndex) is ZERO not ONE. ComboEdit1.Items.Clear; ComboEdit1.Items.Add('A'); ComboEdit1.ItemIndex := 0; <---------- SHOULD BE 0 -
It could be that they simply do not want to make future choices public because they have not planned them as resources yet. For example, rebuilding a 64-bit IDE is expensive, as is porting it to ARM. These are just hypothetical examples and have no connection with Embarcadero. There are no mysteries, we just have to wait for them to publicly inform us about future plans. Bye
-
bug Delphi (Win32) quiets signaling NaN on function return
DelphiUdIT replied to Jim McKeeth's topic in RTL and Delphi Object Pascal
You are right, my brain went on Holiday ... 😞 -
Memory access problem when exchanging WideString in OLE object written in Delphi
DelphiUdIT replied to kihor's topic in Windows API
If you want, you can try this. Is the same COM but with new application: you don't need to register the COM Try to unregsiter the old one. After that build the projetc group (it is setting for WIn64 but you can change for WIn32) and run ... all is working without register the COM thanks to SxS technology (SideBySide). The EXE and DLL will be put in Bin32 and Bin64 (and there are already the manifests). There is a ReadMe and some Manifests (they are all equal excpet for the manifest that is included in the Project1 options). Bye Demo COM SxS.zip -
bug Delphi (Win32) quiets signaling NaN on function return
DelphiUdIT replied to Jim McKeeth's topic in RTL and Delphi Object Pascal
Uhmm... I don't know for the past, but in Delphi12 NaN is defined like 0.0 / 0.0 (yes zero divide 0), so don't try to use it with unmasked exception ... -
When will we have a 64-bit IDE version ?
DelphiUdIT replied to luciano_f's topic in Delphi IDE and APIs
No it isn't. Change the IDE means change the World (all components whould be at 64 bit for example ...). In the last webinar they told they are working about but it's not time to have a date to release. Bye -
Memory access problem when exchanging WideString in OLE object written in Delphi
DelphiUdIT replied to kihor's topic in Windows API
Another thing about COM objects ... look at thread mission (ciMultiIstance, tmApartment) and how they work. Also be very carefull to use global variable for working COM. I suggest you don't use anyglobal variable (except const). -
Memory access problem when exchanging WideString in OLE object written in Delphi
DelphiUdIT replied to kihor's topic in Windows API
If you want this is the global project (DLL_COM + APP) with WIDESTRING result use .... It's only a basic skeleton of course. Bye Demo COM.zip -
Memory access problem when exchanging WideString in OLE object written in Delphi
DelphiUdIT replied to kihor's topic in Windows API
May be with the use of property, (remeber something with my very old use of COM) I can exchange widestring. I remeber to never expose directly string as return function. Let I try to modify your COM ... -
Memory access problem when exchanging WideString in OLE object written in Delphi
DelphiUdIT replied to kihor's topic in Windows API
May be you're right, the return function as string should be a safearray. Instead to use return value, use that as parameter: procedure TMyCOM.DoIt(Value: WideString); stdcall; begin Value := SValue; end;