Jump to content

FPiette

Members
  • Content Count

    1201
  • Joined

  • Last visited

  • Days Won

    16

Posts posted by FPiette


  1. 15 minutes ago, Fudley said:

    I am so sorry I really messed up that description!

    Yes, you did.

    To be clear, you need an Android tablet with ARM CPU.

    To test your application, you need a relatively recent tablet so that it runs the latest Android version. If you buy a reconditioned one, pay attention to which Android it runs.

    Delphi 12 “officially” supports Android 8.1 and higher. Delphi 12.3 officially supports up to Android 15 (API level 35). This is required for Google Play Store apps.

    • Like 1

  2. 46 minutes ago, Fudley said:

    Needs to work with Windows 11. and Delphi 12.

    Do you mean you want to tablet to have a Win11 operating system and you want to run Delphi on the tablet?

    Most tablets have an ARM CPU and run Android or iPadOS.

    Delphi 12 cannot run on a ARM CPU, unless the virtual machine emulating an Intel processor is run above the the OS. In my opinion, this is not possible with a table under $150.

    There are tablet PCs having an Intel processor but their price is much more than $150. They are not in the "cheap" category you are asking. Google is your friend to find them.


  3. 3 hours ago, jesu said:

    Is there any other way I could/should try to restart the webview?

    I don't know.

    I have written only one application which make use TEdgeBrowser. It's part of an automation process which runs every single day without any glitch. In that application, TEdgeBrowser is simply dropped on the VCL form. I don't even use OnCreateWebViewCompleted event.


  4. 4 hours ago, Mustafa E. Korkmaz said:

    I tested the component you sent as follows. It still gave error number 5. The logon function is successful but I get an error in the next step.

    I the next step your app *has* the administrator privileges. Just run the external process as any user using only CreateProcess().

    • Like 1

  5. I have this code which could help you :

    {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    
    Author:       François PIETTE @ OverByte
    Creation:     July 22, 2021
    Description:  Classes to act (File access or other) using another user account.
    License:      This program is published under MOZILLA PUBLIC LICENSE V2.0;
                  you may not use this file except in compliance with the License.
                  You may obtain a copy of the License at
                  https://www.mozilla.org/en-US/MPL/2.0/
    Version:      1.0
    History:
    Jul 22, 2021  1.00 F. Piette Initial release
    
    
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
    unit ImpersonateUser;
    
    interface
    
    uses
        Winapi.Windows, System.Classes, System.SysUtils;
    
    const
        LOGON32_LOGON_NEW_CREDENTIALS  = 9;    // Missing in Delphi 10.4.2
    
    type
        TImpersonateUser = class(TComponent)
        protected
            FUserToken : THandle;
            FErrorCode : DWORD;
        public
            destructor Destroy; override;
            function  Logon(const UserName : String;
                            const Domain   : String;
                            const Password : String) : Boolean;
            procedure Logoff();
            property ErrorCode : DWORD read FErrorCode;
        end;
    
    implementation
    
    { TImpersonateUser }
    
    destructor TImpersonateUser.Destroy;
    begin
        if FUserToken <> 0 then begin
            CloseHandle(FUserToken);
            FUserToken := 0;
        end;
        inherited Destroy;
    end;
    
    procedure TImpersonateUser.Logoff;
    begin
        if FUserToken <> 0 then begin
            RevertToSelf();   // Revert to our user
            CloseHandle(FUserToken);
            FUserToken := 0;
        end;
    end;
    
    function TImpersonateUser.Logon(
        const UserName : String;
        const Domain   : String;
        const Password : String): Boolean;
    var
        LoggedOn : Boolean;
    begin
        Result := FALSE;
        if FUserToken <> 0 then
            Logoff();
    
        if UserName = '' then begin // Must at least provide a user name
            FErrorCode := ERROR_BAD_ARGUMENTS;
            Exit;
        end;
    
        if Domain <> '' then
            LoggedOn := LogonUser(PChar(UserName),
                                  PChar(Domain),
                                  PChar(Password),
                                  LOGON32_LOGON_INTERACTIVE,
                                  LOGON32_PROVIDER_DEFAULT,
                                  FUserToken)
        else
            LoggedOn := LogonUser(PChar(UserName),
                                  PChar(Domain),
                                  PChar(Password),
                                  LOGON32_LOGON_NEW_CREDENTIALS,
                                  LOGON32_PROVIDER_WINNT50,
                                  FUserToken);
        if not LoggedOn then begin
            FErrorCode := GetLastError();
            Exit;
        end;
    
        if not ImpersonateLoggedOnUser(FUserToken) then begin
            FErrorCode := GetLastError();
            Exit;
        end;
    
        FErrorCode := ERROR_SUCCESS;
        Result     := TRUE;
    end;
    
    end.

    Once your code has called Logon(), it act a the user specified by the credentials. When finished, call Logoff().


  6. 5 hours ago, BertB said:

    The software is running on a server and the error occurs only once in a while.

    I shall see what I can do. Have to investigate the project further.

    You can use the remote debugger.

    And as other said, using madExcept is an excellent choice. You'll also have a stack trace. I use madExcept a lot!


  7. 17 hours ago, BertB said:

    Handle Background Exception, source: TCustomWSocket.ASyncReceive - Value 'count' not found

    Is it possible for you to run the application under Delphi debugger?

    If you do, the debugger will show you the exact location of the exception and a stack trace. Those are the best information to understand where and why the exception occurs.


  8. 22 minutes ago, superflexible said:

    My real question is if there are/were any issues with crashes in OpenSSL and how I can prevent them.

    Open a new discussion with a correct the question. And add as many details as possible from your code. Without details, we cannot help much.

    I also suggest you create a minimal reproducible sample program which demonstrate the bad behavior you see in your actual code.


  9. 7 hours ago, mazluta said:

    if IsFileTypeAsClaim('c:\aa\a1.mkv' {full file name and path}) then
        showmessage('file is ok.')
    else
        showmessage('The file is not of the declared type.');

    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/


  10. 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;

     


  11. 14 hours ago, Eric Bonilha said:

    some connections are straight away refused by the OS (When clients try to access the application).

    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.


  12. 3 hours ago, omnibrain said:

    OverbyteIcsSslUtils.TIcsBuffLogStream.FlushFile(False)
    OverbyteIcsHttpRestTst1.THttpRestForm.doStartReqClick(???)

    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.


  13. 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...

    • Like 2

  14. On 2/14/2025 at 5:38 PM, Mark Lobanov said:

    Internal Error: URW1111 while compiling OverbyteIcsD2010Run.dproj in Delphi 2010. There are no errors in Delphi Tokyo.

    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.


  15. 1 hour ago, damos said:

    Never get the message from Client can you give a simple example that line ends with FS+CR  (#28#13)

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


  16. 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.


  17. 10 hours ago, George Bairaktaris said:

    I am open to any suggestions to communicate to wordpress media with TSslHttpRest.

     

    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).

×