Jump to content

FPiette

Members
  • Content Count

    1188
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by FPiette

  1. The write such a function, your have to open the file and check his content to see if is what the file extension pretend. Each file has a specific internal file format, usually in a header. You have to look at the specification for each file format and write code to do more or less serious checks. There is a website which could help you : https://docs.fileformat.com/
  2. FPiette

    Screenshot a Component

    I have this code: procedure TScreenDumpForm.ScreenDump( const FileName : String); var Stream : TFileStream; c : TCanvas; r1 : TRect; r2 : TRect; b : TBitmap; j : TJPEGImage; begin c := TCanvas.Create; b := TBitmap.Create; j := TJPEGImage.Create; Stream := TFileStream.Create(FileName, fmCreate); try c.Handle := GetWindowDC(GetDesktopWindow); try r1 := Screen.MonitorFromWindow(Handle).BoundsRect; r2.Top := 0; r2.Left := 0; r2.Width := r1.Width; r2.Height := r1.Height; b.Width := r1.Width; b.Height := r1.Height; b.PixelFormat := pf24bit; b.Canvas.CopyRect(r2, c, r1); j.CompressionQuality := 60; j.Assign(b); j.SaveToStream(Stream); finally ReleaseDC(0, c.Handle); c.Free; b.Free; j.Free; end; finally Stream.Free; end; end;
  3. FPiette

    Connection refused issue

    After that happens, is the application start working again without restarting it or one it happens no other connection is accepted. If no other connection is accepted, it could be that the listen socket has been closed unexpectedly. This could happens by a bug elsewhere leading to a CloseSocket or even plain winapi CloseHandle function is called with the socket handle.
  4. You are not using a debug version of the application because there is missing details in the stack trace. Make sure you rebuild all, including the components.the debugger should show the excat line where the exception occurs.
  5. Please build using debug configuration and run with the debugger. Then when the debugger hit the exception, copy the call stack and the code around the error, and paste it here.
  6. FPiette

    Guidance on FreeAndNil for Delphi noob

    You can keep this code. It is equivalent to FreeAndNil(FMyObject). Do whatever you feel most readable for you.
  7. FPiette

    Guidance on FreeAndNil for Delphi noob

    I always use FreeAndNil, even if it is the last line of a method. Why? Because my code evolve, I can copy/paste it somewhere, add line,... If the object variable (Actually a pointer btw) is nullified, I'm sure I'll get and exception if I forgot I can no more use that object reference. The impact on performance is nearly null. But all rules can be ignored sometimes...
  8. FPiette

    ICS V9.4 announced

    Since the internal error is in OverbyteIcsWinsock.pas, I suggest you build the simplest console project using the file and produce the internal error. The project doesn't have to do real things. Since URW1111 is an internal error, compiling is enough. Then remove (comment out) code chunks in OverbyteIcsWinsock.pas until the error disappears. Then reduce the size of the offending chunk until you find the line causing the error. This is for sure a long process... Report the offending line here.
  9. FPiette

    ICS as HL7 Server

    In HL7, end of segment is single CR (#13). Set TWSocket LineEnd to single #13.
  10. FPiette

    ICS as HL7 Server

    I have used TWSocket for hospital application (HL7 V2.3) and never had any issue. You should turn line mode on and use CR as line end. The as it is ASCII, use ReceiveStr to get the lines one at a time into a string.
  11. FPiette

    Wordpress upload media

    I don't understand why you can fix the code in your initial post. Just mimic the working code you shown. If you don't understand who to do that, ask SPECIFIC questions. I won't write the code for you (I don't have access to the website you use for testing).
  12. FPiette

    Wordpress upload media

    That code and the ICS code you wrote do not send the same parameters! ContentType is not the same. ContentDisposition is not the same. Accept is not the same. AcceptEncoding is not the same. With ICS, you restrict SSL cypher to sslCliSecTls13Only , no restriction specified in the other side. Data posted must be in form-data format. And maybe other differences for unspecified properties. François Piette
  13. Not sure I understand what you mean. But for sure, you must remove any old components from the IDE and install the new one each time you change ICS (Or any other component) version.
  14. FPiette

    Should I just dive in to GUI programs?

    You write way to long posts! If you like so much Unix shell, use Cygwin under Windows: it has it all.
  15. FPiette

    Should I just dive in to GUI programs?

    There is PowerShell. Version 1.0 was released in November 2006.
  16. Probably the ISAPI DLL doesn't find the OpenSSL DLLs? Or lack permission to load them.
  17. FPiette

    Should I just dive in to GUI programs?

    Yes, you should! Console programming (Like Unix utilities) are mostly included in GUI programs... without GUI.
  18. Always ask the good question so that we don't waste our time answering something unwanted. See Angus answer.
  19. You have to see that at server side. Anything you measure at client side will include transport time and some processing by the receiver. I the server can't tell you the execution time, you can get an approximation by using a network sniffer such as Wireshark. Using this tool you can get the timestamp of the request and the timestamp of the response. The difference gives you the execution by the server.
  20. FPiette

    ICS C++ packages

    There is a way ! The $HPPEMIT directive should do the job. Try to add those lines somewhere near the top of the OverbyteIcsTypes.pas file: {$HPPEMIT '#include <mswsock.h>'} {$HPPEMIT '#include <ws2ipdef.h>'}
  21. Here an example: program Crcr32Demo; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.ZLib; var Buf1 : AnsiString; Buf2 : String; Crc : UInt32; begin Buf1 := 'Hello World!'; Crc := System.ZLib.Crc32(0, PByte(Buf1), Length(Buf1) * Sizeof(Buf1[1])); WriteLn('AnsiString ID=', IntToHex(Crc, 8)); Buf2 := 'Hello World!'; Crc := System.ZLib.Crc32(0, PByte(Buf2), Length(Buf2) * Sizeof(Buf2[1])); WriteLn('UnicodeString ID=', IntToHex(Crc, 8)); ReadLn; end. The output is: AnsiString ID=1C291CA3 UnicodeString ID=E2106423 AnsiString and Unicode string doesn't produce the same result because character code are different (8 bit and 16 bit per character). and CRC32 work at the byte level.
  22. Why don't you use what I proposed? You will always get an 8 characters key and make use only Delphi RTL functions. Please comment on this. I proposed you use CRC32 which is a kind of hash. https://docwiki.embarcadero.com/Libraries/Sydney/en/System.ZLib.crc32 IntToHex: https://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.IntToHex
  23. One possibility is to use a CRC32 applied to the text and then convert the resulting UInt32 to hex-ascii representation. See CRC32: https://docwiki.embarcadero.com/Libraries/Sydney/en/System.ZLib.crc32 IntToHex: https://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.IntToHex
  24. FPiette

    VCL DB App. To Cloud

    That is a very different thing. The rule: correctly define what your problem is and you'll get the best answers.
×