Jump to content

FPiette

Members
  • Content Count

    1167
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by FPiette

  1. FPiette

    C# struct to Delphi conversion help

    My experience shows it is NOT always the case. Manual alignment ALWAYS work.
  2. FPiette

    C# struct to Delphi conversion help

    As I said, use a packed record and dummy data like this: TMembers = packed record ResponsedTag: TTags; Dummy1: array [0..2] of Byte; StartRNo: Array[0..31] of AnsiChar; // continues and ends as following groupDF02: TGrupDF02; groupDF41: TGrupDF41; groupDF6F: TGrupDF6F; end; Also, you must taken into account the sizeof the whole record and mayba add more dummy data at the end to reflect the sizeof in C#/C/C++.
  3. FPiette

    C# struct to Delphi conversion help

    Data alignment in records (struct) are different depending on compiler and alignment directive. Look at Delphi documentation https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Align_fields_(Delphi) To avoid that problem, I always use a packed record and insert dummy data between fields to align used fields the same way as in C++. I use offsetof macro in C/C++ to get the offset of each struct field and a similar Delphi function I wrote to get the offset of a record member. function OffsetOf(const Base : Pointer; const Field) : Integer; begin Result := Integer(UIntPtr(@Field) - UIntPtr(Base)); end; And you can call it like this: var O0 : Integer := OffsetOf(@bitmapProperties, bitmapProperties.pixelFormat);
  4. FPiette

    IOCP

    Probably not.
  5. This stacktrace tells that the EOutOfResources is triggered when you manipulate a TBitMap. This doesn't mean that the TBitMap is the culprit.
  6. EOutOfResource happens when you don't free resources after use and yet allocate a new one. This can come from any resource. Put the thread task in a separate exe to ease testing.
  7. FPiette

    Convert project c# to pascal

    Please ask for specific items you can't convert. Or maybe you a trying to hire someone to do the job?
  8. Is Delphi-Praxis written in Delphi or PHP or something else ? Is it a standard product or whatever ?
  9. Isn't a captcha a valid and easy solution?
  10. You'd better redesign your application using asynchronous functions.
  11. FPiette

    Determine the language

    A spell checker IS basically a dictionary as I described it. It may add grammar check as well.
  12. FPiette

    Determine the language

    You need a dictionary for each language in the document. Then for each line you search the count of known words in each language. You can consider - with an error margin - that the language having the most recognized words is the line language. Dictionaries should contain all variations of each word (singular, plural, masculine, feminine, neuter, all conjugated forms, etc).
  13. You can use the free OpenStreetMap topographic maps and use their "tile server" to download the tiles. Those are simple JPG images of the map at different zoom factor. Look there : https://wiki.openstreetmap.org/wiki/Tiles. URL := Format('https://tile.openstreetmap.org/%d/%d/%d.png', [Zoom, TileX, TileY]); FSslHttpCli.URL := URL; FSslHttpCli.OnRequestDone := SslHttpCliRequestDone; FSslHttpCli.RcvdStream := TMemoryStream.Create; FSslHttpCli.GetASync;
  14. You can create a report at https://quality.embarcadero.com
  15. When buying third party component be sure to buy with FULL source code. And when you receive it, first thing to do is discard any dcu, bpl, obj, dll and all other binary files and rebuild everything. That way you are sure to have full source code an use that code. Why? Because one day or another the developer will disappear or stop updating his code for next Delphi release. With full source code, you can simply [most of the time] rebuild the product with the next Delphi version.
  16. For steps 3, 4 and 5, you need to compute the distance between two consecutive GPS coordinates. For that you use the "haversine distance". Here is some code I wrote for the purpose : // Return distance in meters between two points given by their // latitude/longitude expressed in degrees function HaversineDist( Lat1 : Extended; // Latitude of point 1 in degrees Lng1 : Extended; // Longitude of point 1 in degrees Lat2 : Extended; // Latitude of point 2 in degrees Lng2 : Extended) // Longitude of point 2 in degrees : Extended; // Distance in meters var Dx, Dy, Dz : Extended; const Diameter = 2 * 6372.8 * 1000; // Meters begin Lng1 := DegToRad(Lng1 - Lng2); Lat1 := DegToRad(Lat1); Lat2 := DegToRad(Lat2); Dz := Sin(Lat1) - Sin(Lat2); Dx := Cos(Lng1) * Cos(Lat1) - Cos(Lat2); Dy := Sin(Lng1) * Cos(Lat1); Result := ArcSin(Sqrt(sqr(Dx) + Sqr(Dy) + Sqr(Dz)) / 2) * Diameter; end; Once you get the distance between consecutive GPS points, you can sum the distances to get the track length. To get the speed, you divide the distance by time, you get m/s that you can easily convert to the units you like.
  17. You showed the features you want your application have. Good. But what can you do and what can't you do? To answer to your exact question: Yes, it is possible to do it with Delphi 11.2 and free components/services/API's.
  18. FPiette

    Strange behaviour Windows VCL app on specific laptop

    Do you mean it works now?
  19. FPiette

    Strange behaviour Windows VCL app on specific laptop

    Are you sure about NVIDIA P600 Quadro? I ask because this NVIDIA model is not for a laptop. And I have an HP ZBook 12 G2 which use Intel graphics included in the i7. Anyway, whatever the graphic card is, make sure you have the latest driver installed.
  20. FPiette

    Createprocess won't die

    So you ask X with the intent of solving issue Y that you don't explicit. Instead of launching cmd.exe, just start ping.exe and kill it when you want.
  21. FPiette

    Createprocess won't die

    This won't answer your question directly, but why not simply use TPing component from ICS inside your application? ICS has several demos for the component: OverbyteIcsPingTst, OverbyteIcsPingTst64 and OverbyteIcsConPing. You can download open source ICS from https://wiki.overbyte.be and also directly from Delphi IDE (GetIT menu). If you need help, there is a dedicated forum on this server: https://en.delphipraxis.net/forum/37-ics-internet-component-suite/
  22. FPiette

    Hosting a console in a Delphi Application

    No need to call AllocConsole: it is enough to check "make console application" in the project options AFTER having created a GUI application. Delphi RTL will create a console Window. Not that it is not enough to run cmd and powershell! See my previous message.
  23. FPiette

    Hosting a console in a Delphi Application

    You have to launch the corresponding command interpreter executable. If you don't want to have it in a separate floating window, you must redirect input and output to your own application using pipes. You'll easily find numerous Delphi libraries for the purpose. Search "Delphi Redirect input output" or "interprocess communication using pipes" (remove double quotes) with your favorite search engine.
  24. FPiette

    TSocket.Send result

    What you seems not understand yet is that Send() don't send data! It just put data in the send buffer and let the component send it when the network is able to accept it. Your application code continue to run long before the data is completely sent. That is asynchronous operation.
×