Jump to content

TiGü

Members
  • Content Count

    39
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by TiGü


  1. First, maybe that helps: https://stackoverflow.com/a/6616121

     

    Do you use this?

    https://github.com/maerlyn/old-delphi-codes/blob/master/_KOMPONENSEK/Comms.pas 

     

    Check for Mainthread with a construct like 

     

    procedure TForm62.comportclient1Receive(Sender: TObject; InQue: Integer);
    begin
        if TThread.Current.ThreadID = MainThreadID then
        begin
            SendMessage(handle, pm_ProcessBarcodeScan, WPARAM(0), LPARAM(0));
            Application.ProcessMessages;
        end;
    end;

     

     


  2. Check TNotificationWinRT.Create.

    I assume your lNotification is freed before it used here.

     

    constructor TNotificationWinRT.Create(const ANotificationCenter: TNotificationCenterWinRT;
      const ANotification: TNotification);
    var
      DeleateActivate: TNotificationCenterDelegateActivated;
      DelegateDismiss: TNotificationCenterDelegateDismiss;
      DelegateFailed: TNotificationCenterDelegateFailed;
    begin
      FToast := TToastNotification.Factory.CreateToastNotification(TToastTemplateGenerator.GetXMLDoc(ANotification));
      DeleateActivate := TNotificationCenterDelegateActivated.Create(ANotification);
      FDelegateActivatedToken := FToast.add_Activated(DeleateActivate);
    
      DelegateDismiss := TNotificationCenterDelegateDismiss.Create(ANotificationCenter, ANotification.Name);
      FDelegateDismissToken := FToast.add_Dismissed(DelegateDismiss);
    
      DelegateFailed := TNotificationCenterDelegateFailed.Create(ANotificationCenter, ANotification.Name);
      FDelegateFailedToken := FToast.add_Failed(DelegateFailed);
    end;

     


  3. 14 hours ago, david_navigator said:

    but the only place I can find GetTemplateContent is in Winapi.UI.Notifications class function TToastNotificationManager which won't accept a break point

    The "Debug DCU" option is checked in the project options?

    Only with this you can debug in VCL and RTL source code (System, Winapi, etc.).

     

    Anyway, the use of Application.ProcessMessages looks like a code flaw and is the wrong approach in most cases.


  4. unit REST.Types // Delphi 10.4
    
    ...
    
    type //at line 123
      /// <summary>
      /// Content
      /// </summary>
      TRESTContentType = (ctNone, ctAPPLICATION_ATOM_XML, ctAPPLICATION_ECMASCRIPT, ctAPPLICATION_EDI_X12,
        ctAPPLICATION_EDIFACT, ctAPPLICATION_JSON, ctAPPLICATION_JAVASCRIPT, ctAPPLICATION_OCTET_STREAM, ctAPPLICATION_OGG,
        ctAPPLICATION_PDF,... // <-------

     


  5. I know, this thread is a little bit dated, but I take a look to your github repository.

    https://github.com/fpiette/OvbImgOrganizer/blob/main/Source/Direct2D_1/Vcl.Direct2D_1.pas

     

    Have you ever tried to change your SwapEffect in DXGI_SWAP_CHAIN_DESC1?

    You use DXGI_SWAP_EFFECT_DISCARD in Line 1207 but the most recent examples recommend DXGI_SWAP_EFFECT_FLIP_DISCARD or  DXGI_SWAP_EFFECT_SEQUENTIAL_DISCARD.

    https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_effect

     

    Maybe you should use just the normal Present-Method of the Swap Chain.

    So, just write DXGISwapChain.Present instead DXGISwapChain.Present1 and get rid of the PresentParams : PDXGIPresentParameters because you don't use it anyway.

     

    https://social.msdn.microsoft.com/Forums/en-US/4737f4f6-68a4-45eb-8941-13f68802153a/why-direct2d-idxgiswapchain1present1-is-much-slower-than-directdraw?forum=windowssdk

     

    https://walbourn.github.io/care-and-feeding-of-modern-swapchains/

     

     

    Are you familiar with the DirectX debug layers?

    So, if you do something fishy with your DirectX stuff, the Debug Layers will tell you in the (Debug) Event Log (you must read both links).

    It's a great help during development:

     

    https://docs.microsoft.com/en-us/windows/win32/direct3d11/using-the-debug-layer-to-test-apps

    https://docs.microsoft.com/en-us/windows/win32/Direct2D/direct2ddebuglayer-overview

     

    Please add D2D1_DEBUG_LEVEL_INFORMATION to FactoryOptions.DebugLevel before calling D2D1CreateFactory and D3D11_CREATE_DEVICE_DEBUG to the CreationFlags before calling D3D11CreateDevice.

    If you wrap it between {$IFDEF DEBUG} and {$ENDIF}, you have a clean Release code.

     

    image.thumb.png.74de50ad74d110490689ec09cfa87dc7.png

    • Like 2
    • Thanks 1

  6. You can check if your normal ID2D1RenderTarget/ID2D1HwndRenderTarget/ID2D1DCRenderTarget from the TDirect2DCanvas supports the newer Direct2D 1.1 ID2D1DeviceContext.

    Something like this:

      // Self.Handle is the HWND of your Form...
      FVCLCanvas := TDirect2DCanvas.Create(Self.Handle);
      var DeviceContext: ID2D1DeviceContext;
      if Supports(FVCLCanvas.RenderTarget, ID2D1DeviceContext, DeviceContext) then
      begin
        var YourPointer: Pointer;
        var DontForgetThePitch := 1024;
        var AllImportantBitmapProperties: D2D1_BITMAP_PROPERTIES1;
        var D2D1Bitmap: ID2D1Bitmap1;
        DeviceContext.CreateBitmap(SizeU(1024,1024), YourPointer, DontForgetThePitch, @AllImportantBitmapProperties, D2D1Bitmap);
        DeviceContext.DrawImage(D2D1Bitmap, nil, nil, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
      end;

    I assume you will find out the details on your own (Fill the Pointer to your Data, Pitch, Bitmap props).

     

    Or you build the entire Direct 2D 1.1 - 1.3 thing by yourself and forget the crappy TDirect2DCanvas.

    Microsoft had a lot of DirectX samples and all of them have a abstract class called "DirectXBase" (e.g. https://github.com/microsoft/VCSamples/blob/master/VC2012Samples/Windows 8 samples/C%2B%2B/Windows 8 app samples/Direct2D interpolation modes sample (Windows 8)/C%2B%2B/DirectXBase.cpp).

     

    You can use the attachment pascal unit as a starting point.

    I recommend the header translations from MfPack (https://github.com/FactoryXCode/MfPack) for this.

    DirectXBase.pas

    • Like 1
    • Thanks 1

  7. I had the same problem today in my Delphi 10.4.
    After some searching and comparing with a newly created registry key for Delphi, I found out that it is due to the disabled entries in the IDEInsight key.

     

    Example:

    [HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\IDEInsight]
    "Disabled0"="Project Options"
    "Disabled1"="Components"
    "Disabled2"="Object Inspector"
    "Disabled3"="New Items"
    "Disabled4"="Open Files"
    "Disabled5"="Recent Files"
    "Disabled6"="Recent Projects"
    "Disabled7"="Component Palette"
    "Disabled8"="Code Templates"
    "Disabled9"="Desktop SpeedSettings"
    "Disabled10"="Projects"
    "Disabled11"="Files"
    "Disabled12"="Forms"
    "Disabled13"="Commands"
    "Disabled14"="Preferences"

    After deleting the complete key in the registry and restarting Delphi, IDE Insight worked again.

    • Like 1

  8. Please stop to wonder about the font(s). It does not matter!

    The problem is the text rendering itself in the editor of the Delphi IDE.

     

    In the screenshot you can see a few examples in the Delphi IDE and in Visual Studio Code.

    In both cases, the font is the famous Consolas from Microsoft (https://en.wikipedia.org/wiki/Consolas). 

     

    Most european languages like German, Swedish or Hungarian are well rendered. Even Greek is displayed nice.

    But all others looks like a pile of shit. Arabic is broken, Thai has to much space between the symbols.

    The same problem occours in Khmer and Sinhala (mispelled as Shinghal in the source code).

    Chinese look okay, but not perfect.

     

    Conclusion:

    The Delphi IDE Editor is designed for European character sets only.

     

    image.thumb.png.7e3fe7163f11e7813e0bc3721d2d1438.png

    • Like 1

  9. 2 minutes ago, Der schöne Günther said:

    I still don't get quite behind that language server thing. I see that they will be able to delegate things like Code Completion and Error Insight to some external process in the background.

    Same here. Perhaps it's a important thing, but what exactly is the benefit for a single dev like you and me?

    Besides, a working error insight would be almost like heresy. There's never been anything like this for Delphi before! 😈

    • Haha 1

  10.  

    2 hours ago, Schokohase said:

    It is also pointless to place a pull request if you know that it will break code for Versions < XE3 while the library clearly states

     

    The contributer knows it, but did not provide a solution in code

     

    2 hours ago, ByteJuggler said:

    Especially with new contributors to open source (but also in general) it's usually advisable in the interests of friendly cooperation to exercise some patience and politeness and give contributors some friendly feedback about their pull requests if they should accidentally miss this or any other type of requirement that change requests should comply with (and to do so in the context where the pull request was submitted.)  If the JCL/JVCL maintainers are not giving at least this feedback to people trying to contribute then that's rather a shame.  😞

    Especially when younger pull requests are commented and this one is simply ignored.
    The maintainers can say: "Ok, that was nice, but come back when you have a version that works with Delphi 6".
    But ignoring it completely is not cool. You know the German proverb: "Kannste man so machen, aber dann ist halt K*cke!"

    My motivation to ever participate again for the JCL or JVCL is at a minimum.


  11. Hm...in Delphi Tokyo we can find in SysSysctlTypes.inc:

     

    (* TODO -otgerdes -cTranslate: kinfo_proc (needs proc.h)
    struct kinfo_proc {
            struct  extern_proc kp_proc;                    // proc structure
            struct  eproc {
                    struct  proc *e_paddr;          // address of proc
                    struct  session *e_sess;        // session pointer
                    struct  _pcred e_pcred;         // process credentials
                    struct  _ucred e_ucred;         // current credentials
                    struct   vmspace e_vm;          // address space
                    pid_t   e_ppid;                 // parent process id
                    pid_t   e_pgid;                 // process group id
                    short   e_jobc;                 // job control counter
                    dev_t   e_tdev;                 // controlling tty dev
                    pid_t   e_tpgid;                // tty process group id
                    struct  session *e_tsess;       // tty session pointer
    #define WMESGLEN        7
                    char    e_wmesg[WMESGLEN+1];    // wchan message
                    segsz_t e_xsize;                // text size
                    short   e_xrssize;              // text rss
                    short   e_xccount;              // text references
                    short   e_xswrss;
                    int32_t e_flag;
    #define EPROC_CTTY      0x01    // controlling tty vnode active
    #define EPROC_SLEADER   0x02    // session leader
    #define COMAPT_MAXLOGNAME       12
                    char    e_login[COMAPT_MAXLOGNAME];     // short setlogin() name
    #if CONFIG_LCTX
                    pid_t   e_lcid;
                    int32_t e_spare[3];
    #else
                    int32_t e_spare[4];
    #endif
            } kp_eproc;
    };
    *)

     


  12. 18 hours ago, David Heffernan said:

    Even on windows, IsDebuggerPresent is not the same as System.DebugHook <> 0. The former tests for any debugger, the latter tests for the Emba debugger.

    That's good to know! Thank you for the clarification. 

    I stumbled upon this interesting blog post:

    https://xorl.wordpress.com/2017/11/20/reverse-engineering-isdebuggerpresent/

     

    There must be similar mechanics on iOS, Android, Linux and macOS. I personally know too little about that. 😞


  13. 17 minutes ago, Sherlock said:

    To easy @TiGü:

     

    But as we can see in the 

    class procedure TThread.NameThreadForDebugging(AThreadName: string; AThreadID: TThreadID);

    there are following lines:

    ...
    {$ELSEIF Defined(ANDROID)}
      if (System.DebugHook <> 0) or (getenv(EMBDBKPRESENTNAME) <> nil) then
    {$ELSE}
    ...

    So, i guess it's defined for Windows and Android and working on both platforms.

     

    Hast du wirklich deine IDE auf Deutsch gestellt?  

×