Jump to content

gioma

Members
  • Content Count

    115
  • Joined

  • Last visited

Posts posted by gioma


  1. I have an application that uses a TDirect2DCanvas to render an image stream.
    However, I noticed that the iterpolation used is only Linear (Direct2D 1.0), but if I wanted to use those introduced with Direct2D 1.1 (bicubic, etc.) i would have to add unit Winapi.D2DMissing.
    Now the problem is that the TDirect2DCanvas does not use ID2D1DeviceContext (added in Winapi.D2DMissing) as the rendering target but ID2D1RenderTarget.
    I can't figure out how to use the new Direct2D 1.1 features.
    Anyone has any ideas?


  2. 14 hours ago, PeterBelow said:

    buf is declared as a single Widechar but you tell ToUnicodeEx that it can hold 255 Widechars. A good way to ruin your call stack. :classic_cool:

    13 hours ago, Remy Lebeau said:

    There are a number of problems with that code:

     

    - the wScanCode parameter of ToUnicodeEx() is not optional. Unfortunately, the OnKeyUp event does not give you the original scan code that the OS provided in the WM_KEYUP message.  However, in this case, since only bit 15 of the scan code is really needed, you can fake it.  For a KeyUp event, bit 15 needs to be set to 1, not 0.

    - you are not populating the TKeyboardState before passing it in to ToUnicodeEx().  You need to call GetKeyboardState() first.

    - you are passing in a single WideChar for the output buffer to ToUnicodeEx(), but you are telling ToUnicodeEx() that the buffer is large enough to hold 255 WideChars, which is a lie. The output of the conversion can be more than 1 WideChar, so you need to allocate enough space to hold the entire result.  The return value will tell you how many WideChars were actually written to the buffer.

    - ToUnicodeEx() alters the keyboard state while translating the key, unless you ask it not to (Windows 10+ only).

    - WideCharToString() expects a null-terminated PWideChar string, not a single WideChar.

     

    With that said, try something more like this instead:

    
    procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    var
      buf: array[0..15] of WideChar;
      KSta: TKeyboardState;
      numChars: Integer;
    begin
      Winapi.Windows.GetKeyboardState(ksta);
      numChars := Winapi.Windows.ToUnicodeEx(key, $8000, ksta, buf, Length(buf)-1, 4, 0);
      if numChars > 0 then
      begin
        buf[numChars] := #0;
        log.Lines.Add('KeyUp : ' + IntToStr(Key) + ' = ' + WideCharToString(buf));
      end
      else if numChars = 0 then
        log.Lines.Add('KeyUp : ' + IntToStr(Key) + ' = (no translation)')
      end else
        log.Lines.Add('KeyUp : ' + IntToStr(Key) + ' = (dead key)');
    end;

    However, if you really want to handle individual key presses, you should be using the OnKeyPress event of the OnKey[Down|Up] events, as previously stated.  The OnKeyPress event gives you translated Unicode characters, not virtual key codes.

    
    procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      log.Lines.Add('KeyPress : ' + IntToStr(Key) + ' = ' + Key);
    end;

     

    You're right! Fixed the error now it works 🤩

     

    procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    var
    
      buf:WideChar;
      KSta:TKeyboardState;
    begin
      //initialize TKeyboardState
      GetKeyboardState(ksta);
      //limit to 1 the capture lenght into buffer that is wide char
      ToUnicodeEx( key, 0, ksta, @buf, 1, 0, 0);
      log.Lines.Add('KeyUp : '+ inttoStr(key)+'='+buf );
    
    end;

    Now if I press "è" it wrote into TMemo: 

    KeyUp : 186=è

    Thank you all! :classic_smile:

     

     


  3. I almost found a solution:

     

    procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    var
      buf:WideChar;
      KSta:TKeyboardState;
      s:string;
    begin
      log.Lines.Add('KeyUp : '+ inttoStr(key) );
      Winapi.Windows.ToUnicodeEx( key, 0, ksta, @buf,255, 0, 0);
      s:=WideCharToString(@buf);
      log.Lines.Add('KeyUp : '+ s);
    end;

    Obviously I will not use it like that, but there is a problem, it goes into exception when it writes the result to the log (TMemo).
    Even if I levo the last line goes into exception, however the variable s is valued.


  4. Hi everyone, I'm making an application that communicates between different operating systems. In this case I have to send a character when it is pressed from Windows to MAC.
    In the Form.OnKeyUp function there is the parameter "key: Word" which represents the character code.
    If it is not a special character (à, è, ì, ò, ù) this co corresponds to the ASCII code.
    If, on the other hand, I press the "è" key, the code will be 222 which however does not correspond to its ASCII code and therefore I send wrong information to the MAC which is unable to retrieve the corresponding character.
    How do I get the exact ASCII code of that character?
    Thank you all.


  5. 18 minutes ago, Wil van Antwerpen said:

    I mean that the secure desktop cannot be programmatically controlled from another session and desktop.
    This is a security measure in Windows and not even a system user can get around that.

    There are remote control programs that let you choose which session to open the connection in, how do they do it?


  6. 3 minutes ago, Der schöne Günther said:

    The login screen is an entirely different "desktop" (not to be confused with "Virtual desktops" which were introduced with Windows 10), much like an elevation prompt ("user account control").

     

    An application that runs without administrative privileges cannot access that "secure desktop" the login screen is running on. You can, for example, also see this with other solutions like TeamViewer or AnyDesk: When they don't have administrative privileges and the user locks his account, they can't do anything.

    My application not only has administrator privileges, but runs as a System user.


  7. Hello,
    I am creating a remote control program using the WebRTC.
    I have a problem, however, when the user I am connected to locks the screen I cannot access the welcome screen. In fact, at that moment, it seems that the streaming of the desktop is interrupted, while the connection between the two clients remains active, so they can exchange messages.
    Assuming the logged in user knows the access credentials, I'm looking for a way to re-login via the windows API and unlock the screen.
    It's possible to do it?
    I tried with LogonUser, but although the result is positive it does not unlock access.
    Maybe I should try using PostMessage?


  8. I have installed the patch but nothing changes:

     

    [PAClient Error] Error: E0776 2020-12-18 10:22:36.975 xcodebuild[2324:116233] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/m_/9ddrsvpx4wl6gffm17_2yky40000gn/T/IperiusRemote_2020-12-18_10-22-36.974.xcdistributionlogs'.
    [PAClient Error] Error: E0776 Exported IperiusRemote to: /Users/imac_enter/PAServer/scratch-dir/Utente-IMAC/IperiusRemote.archive/temp
    [PAClient Error] Error: E0776 ** EXPORT SUCCEEDED **

     

     

    I had to use XCode 11 .. 😞

     



  9.  

    Quote

     

    To do this, we recommend using the GetItCmd.exe tool: GetItCmd.exe -c=useonline

     

     

     

    I have tried to use GetitCmd.exe but I receive this response : 

     

    GetIt Package Manager - Version 7.0
    Copyright (c) 2020 Embarcadero Technologies, Inc. All Rights Reserved.


    Command failed with 1 exit code!

     

     

    On the Welcome page of Delphi it shows me this message:
    The Embarcadero GetIt server could not be reached.

     

     

    This has been happening since I installed Sydney 10.4.1


  10. Hi, 

    I recompiled an FMX project in Delphi 10.4, but I noticed, only for the iOS release that the TRESTClient component is not working well.
    When I go to execute the Execute method, it does not return the value of the call but the method remains hung.
    Instead for the Android version everything works correctly.

    is it a bug?

     

    	_rRequest.Body.ClearBody;
        _rRequest.Params.Clear;
        _rRequest.Method := TRESTRequestMethod.rmGET;
        _rClient.BaseURL:=_host_url+'/api/gateway/host?id='+fullIdHost;
        _rClient.Params.Clear;
        _rRequest.Execute;
        _statusCode:=_rResponce.StatusCode;

     


  11. I created the project, compiled it and installed it on the phone and by default it took the name of $ {modulename}.I changed the value of CFBundleDisplayName to "Progect Options-> Version Info" with the name I would like it be displayed, but it remains the default one.
    I checked the .plist file and in fact it is the correct one.
    I don't know what else to do, I have to distribute but I'm stuck with this s@it.


  12.  I can't change the project name.

    But anyway according to this delphi guide it is possible to do this: 

     

    https://community.embarcadero.com/article/technical-articles/145-ui/973-how-can-i-change-name-of-firemonkey-mobile-application-to-contain-spaces

     

    The problem is that on Android it works, while on iOS it doesn't.

    Yet another Delphi bug?

    Yet the "Info.Plist" file is created well, and the key "CFBundleDisplayName" has the correct value.

    Except that when you install the app, the project name is displayed as the app name.

    Other Apps show the name with spaces, I don't understand why I can't do it with my app ...

     

    However it is not just the problem of inserting a space, I would like a different name for the app than the project one!

     

×