Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    Assigning UTF-8 to a control

    If it's a char* then no. But if you held the data in a type that also had an encoding then the rtl would convert. Why not convert to utf16 as early as possible though?
  2. David Heffernan

    Assigning UTF-8 to a control

    Where is the UTF8 text coming from?
  3. David Heffernan

    set of object instances

    Yes they did
  4. David Heffernan

    set of object instances

    Doesn't handle duplicates
  5. David Heffernan

    set of object instances

    Spring has a collection that meets your needs. With pure rtl you can fake it with a geneic dictionary.
  6. David Heffernan

    Local variables broken when debugging .obj files?

    If I were you I'd compile the code into a DLL and link to that. My experience is that works more reliably. I used to do the .obj dance back in the day but moved away from it. Very happy to have done so.
  7. David Heffernan

    Local variables broken when debugging .obj files?

    I didn't even know that Delphi debugger would step into obj files. How did you compile the .obj file? Where is Delphi getting the debug info from?
  8. David Heffernan

    Can anyone spot the errors?

    I don't really understand this either. I think @PeterBelow was just stating this clearly, and did a good job of it.
  9. David Heffernan

    Sorting two lists in step?

    The most interesting thing here for me is that the question asks about sorting, but in reality what you wanted to do was efficient lookup of name/value pairs.
  10. David Heffernan

    Sorting two lists in step?

    Fairly simple to write a function to save the content of a collection to a text file.
  11. David Heffernan

    ini file not writtable

    Not with the code most recently by the asker. That singleton code is enormously complex, obfuscates, and is certainly not helpful here.
  12. David Heffernan

    ini file not writtable

    Replace thus with Settings.Free which internally performs that nil check
  13. David Heffernan

    ini file not writtable

    None of this is making much sense but whatever. More generally I strongly recommend you get out of the habit of using global variables.
  14. David Heffernan

    ini file not writtable

    Use a debugger, and look at what is in apath. Knowing how to use a debugger is a bit skill.
  15. David Heffernan

    ini file not writtable

    We don't know what Settings is. How about a minimal but complete example.
  16. David Heffernan

    security with no access to the cmd.exe

    It depends on what your external processes do. If you are trying to do something that will be locked down then I guess it will be affected. But calling CreateProcess per se doesn't requires cmd.exe. Unless that's the process that you are trying to create.
  17. David Heffernan

    Delphi 7 compatibility with Windows 11?

    Nope, still there, why would MS remove it
  18. David Heffernan

    Sorting two lists in step?

    Is you real problem that these two strings belong together? In which case declare a record with them in, store them in TList<TYourRecord> and that's the answer, end of story.
  19. David Heffernan

    How can I allocate memory without raising exceptions ?

    Yeah, just try setting a break point on the GetMem function implementation and see how many times it gets hit. I ask again. Does you program use any string variables? Does it instantiate any classes? What is you policy for these heap allocations? Why are you creating problems where there are none?
  20. David Heffernan

    How can I allocate memory without raising exceptions ?

    This is the only place in your program where you use string variables? And you don't use any classes?
  21. David Heffernan

    Decrement a value by 1 each time a function is called

    It's something of an anti-pattern to call Randomize more than once in the lifetime of a process. Why do you have this call here?
  22. David Heffernan

    How can I allocate memory without raising exceptions ?

    If memory can't be allocated then the message can't be sent and presumably the program stops working? I think your model of avoiding try is probably very flawed. You are about to call PostMessage which has a kernel mode transition. Your try is not the hot-spot in this code!
  23. David Heffernan

    Delphi 7 compatibility with Windows 11?

    Instead of us guessing, it would be more productive for you to boil this down to the simplest example that reproduces the issue.
  24. David Heffernan

    Delphi 7 compatibility with Windows 11?

    Hard to know why this is happening with the information we have.
  25. David Heffernan

    How can I allocate memory without raising exceptions ?

    Because when memory allocation fails it's very hard to recover. Also, you don't control the allocation for strings. The rtl does that. You'd need to redesign you entire program to work with low memory scenarios. The entire rtl/vcl etc. is not designed to work in these scenarios.
×