Jump to content

Vandrovnik

Members
  • Content Count

    135
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Vandrovnik


  1. 7 minutes ago, Ian Branch said:

    OK.  I'll have another try.

    I have had a look at the article above and am trying to integrate the ShutdownBlockReason.... functions.

    Where are the declared/defined?

    Did you read, what Cristian Peța linked?

     

    function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external user32;
    function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external user32;

     


  2. 12 minutes ago, David Heffernan said:

    If what you say were true, then class forward references would not exist.

    I believe Anders is right.

    Class reference is just a pointer - its size is known. When you use this class as a member of another class (fChild: tChild, where tChild is a class), you cannot reference its members in properties (property x: integer read fChild.x). If fChild is a record (fChild: tChild, where tChild is a record), you can reference its members in properties, like in Anders' example (property x: integer read fChild.x).


  3. tDictionary alone will not allow you to store more values for the same key (it seems you need it: "I get all values of (TKey1 = 1) for the data. ").

    You could use two dictionaries:

    tDictionary<tKey1, tObjectList>

    tDictionary<tKey2, tObjectList>

     

    In these object lists, there will be all objects with corresponding values of the tKey1, resp. tKey2.

     


  4. You mean something like this?

    type tSledovaniVykonuSeznamVysledku=class(tObjectList<tSledovaniVykonuVysledky>)
    ...  
     var Cmp: IComparer<tSledovaniVykonuVysledky>;
     begin
     Cmp:=tDelegatedComparer<tSledovaniVykonuVysledky>.Create(
      function(const Left, Right: tSledovaniVykonuVysledky): Integer
       begin
       result:=CompareStr(Left.Nazev, Right.Nazev);
      end);
     Sort(Cmp);

     


  5. Hello,

     

    Please can you advise a profiler for Win32/Win64 applications (made in Delphi)? Free, when possible (I do not need the profiler often).

    What I have found using Google was expensive or quite outdated or buggy.

    Kind regards,

     

    Karel

     


  6. 7 minutes ago, David Schwartz said:

    This is running inside a VM and I cannot install Delphi in it, so the debugger cannot be used.

    What about remote debugging?


  7. This compiles, but I have not tested, whether it works as expected 🙂


     

         ToField<T> = class(tObject)
          private
           fData : T;
          protected
           procedure SetFromVariant(const aValue : Variant);
         end;
    
    
    procedure ToField<T>.SetFromVariant(const aValue: Variant);
     var val: TValue;
     begin
     val := TValue.FromVariant(aValue);
     fData := val.AsType<T>;
    end;
    

     

    • Thanks 2

  8. 2 hours ago, Cristian Peța said:

    I don't understand. Have you reproduced this on your machine? Then you can debug and see the call stack.

    If not, then as @Lars Fosdal said: get MadExcept or EurekaLog and don't waste your time.

    I dot't know how EurekaLog is but with MadExcept you need only to install it and check the checkbox that you want it in your app. That's all. Then you will have a full call stack to see where this happens in your code.

    But he wrote that error happens in external .dll when he opens a query, not in his code.

    • Like 1
×