Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. I don't think this is true. TEdit is the Win32 EDIT control. What are you doing with strings that need to know what you are asking about? What's your usage scenario?
  2. Why would you need to know this, unless you are rendering the text
  3. David Heffernan

    List of usable RegEx for source code

    Isn't that going to claim a global lock 31 times?
  4. David Heffernan

    Getting Label Name from Label.Caption

    Put the labels in an array, and then access them by index, or Use a single label, and include linebreaks in the caption, or Create the labels dynamically, or Probably some other solutions that I have not thought of.
  5. David Heffernan

    List of usable RegEx for source code

    It's always a good idea to minimise contention on process wide locks, which is why it is best not to call SetLength over and over when that can readily be avoided.
  6. David Heffernan

    Returning a dynamic array from DLL

    Thus can't work. You need both sides of the interface to use the same memory allocator and the same dynamic array implementation. Which ties you to specific delphi versions. That forces your plugins writers to use Delphi. Amongst other requirements.
  7. David Heffernan

    List of usable RegEx for source code

    Really? Contention on a lock has the same impact irrespective of how many items are in the collection.
  8. David Heffernan

    List of usable RegEx for source code

    Well, won't they suffer when you make lots of reallocations. That's always been my experience.
  9. David Heffernan

    List of usable RegEx for source code

    What about multithreaded programs?
  10. David Heffernan

    QueryPerformanceCounter precision

    That's nice. But it's off topic here.
  11. David Heffernan

    QueryPerformanceCounter precision

    I don't think you understand. You talked about a .net class, but we are talking about the Delphi RTL.
  12. David Heffernan

    QueryPerformanceCounter precision

    Well yeah, that's to be expected. And it's not just QPC. If the processor runs in a slower mode, then you code will be slower. And of course when you measure it, that will be reflected, no matter how you measure it.
  13. David Heffernan

    QueryPerformanceCounter precision

    No, that's not what you said. You were quoting an MS document that was talking about the .net System.Diagnostics.Stopwatch class.
  14. David Heffernan

    QueryPerformanceCounter precision

    You said that you were replacing TStopwatch with QPC, but TStopwatch is implemented using QPC. So this entire effort is pointless. That's my point. TStopwatch.Frequency comes from a call to QPF. TStopwatch.GetTimeStamp is QPC. And TStopwatch.ElapsedTicks is the difference between QPC when you started the stopwatch, and QPC when you called ElapsedTicks. I guess you were previously calling TStopwatch.ElapsedMilliseconds and wanted more precision. Which you can get by switching to TStopwatch.ElapsedTicks.
  15. David Heffernan

    QueryPerformanceCounter precision

    There aren't any options with QPC. It just returns a 64 bit int. Which TStopwatch passes on to you. And the performance counter frequency is also available. The only possible explanation for this entire thread is that @Mike Torrettinni has not realised this. I guess he is blocking me because otherwise he would read my posts and realise this.
  16. David Heffernan

    changing inherited control

    Why don't you use OnMouseDown?
  17. David Heffernan

    QueryPerformanceCounter precision

    Am I the only one who finds it odd that we have a two page thread on replacing TStopwatch with QPC when in fact TStopwatch is QPC. Perhaps somebody else could point out to @Mike Torrettinni that when he says It's actually what he had originally with TStopwatch.
  18. David Heffernan

    QueryPerformanceCounter precision

    I don't understand why you don't just use TStopwatch......
  19. You really should not be trying to manage allocation manually. Your should try to avoid that.
  20. Uff, I didn't read your code properly. I assumed you were using TList. So, yeah you just declare a local variable of the record type, populate it, and add it. As Stefan says, clarity on value vs reference semantics is key.
  21. You would destroy those items using Dispose, since you made them with New. But that's the wrong solution. Use TList<TReminderItem> which will give you a type safe collection whose items are allocated and destroyed by the list itself.
  22. David Heffernan

    QueryPerformanceCounter precision

    TStopwatch is implemented on Windows using QueryPerformanceCounter......
  23. David Heffernan

    Determining why Delphi App Hangs

    Doesn't seem like ProcessMessages is really relevant here. Nothing is calling ProcessMessages.
  24. David Heffernan

    Determining why Delphi App Hangs

    Run in the debugger. When it hangs, use Run | Program pause to pause execution. Look at the thread window, and double click the main thread since I guess that is the thread which is hung. Look at the call stack window which will tell you what the thread is doing that is not completing.
  25. David Heffernan

    Min & Max

    Why does this bother you? Why don't you want to use System.Math?
×