Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    TThread issue

    It's a bug for the very reasons that you raised! When the thread was created in the constructor of `TThread` it meant that you couldn't synchronise passing state to the thread before it started.
  2. David Heffernan

    TThread issue

    Creating them non-suspended explicitly does what you wish also.
  3. David Heffernan

    TThread issue

    Do that in the constructor of the thread if you wish. No need to create the thread suspended.
  4. David Heffernan

    TThread issue

    That was a bug fixed in Delphi 6, and one of the reasons for the introduction of AfterCreation. I never create threads suspended.
  5. David Heffernan

    TThread issue

    Yes. What happens if you pass False and so don't create suspended?
  6. David Heffernan

    How to manage defined list values

    I use attributes attached to enumerated types to handle this
  7. David Heffernan

    TThread issue

    Why are you creating the thread suspended. What happens if you don't do that?
  8. David Heffernan

    Shellexecute @ UBUNTU platform

    If I actually disagreed with you, I'd produce a counter example. I don't think I have because I don't think there is one. Therefore I can't believe that I disagree.
  9. I don't think that there was any difference regarding the streams. I think you've just mixed up the begin/end update with the streams and got a bit of cargo cult. FWIW your try/finally is not right.
  10. This looks a bit bogus to my eyes. Why would this change anything. Surely LoadFromFile use a file stream.
  11. David Heffernan

    New TForm - Defaults

    I guess you could modify DefFontData in a design time package
  12. David Heffernan

    Shellexecute @ UBUNTU platform

    No need for a workaround. Creating processes, and waiting for them to terminate is routine stuff on all platforms. Definitely worth seconding everything that @Remy Lebeau said. You don't want to replicate ShellExecute because you don't want to use it at all. ShellExecute is used to execute shell verbs. But you want to create a process. A quite different thing altogether. Albeit the open verb on an executable file often results in a new process being created.
  13. David Heffernan

    Shellexecute @ UBUNTU platform

    There is no way to replace all the functionality of ShellExecute which encompasses the entire shell verb mechanism in Windows. What specific functionality of ShellExecute are you looking to replicate?
  14. David Heffernan

    Patch a private virtual method

    @Stefan Glienke Your code above (and in spring4d) uses WriteProcessMemory to modify executable pages. This relies on an undocumented implementation detail of WriteProcessMemory. Namely that it will handle the protection flags on your behalf. Personally I would prefer to use VirtualProtect with this sort of pattern: procedure PatchCode(Address: Pointer; const NewCode; Size: Integer); var OldProtect: DWORD; begin if not VirtualProtect(Address, Size, PAGE_EXECUTE_READWRITE, OldProtect) then begin Fail; end; Move(NewCode, Address^, Size); FlushInstructionCache(GetCurrentProcess, nil, 0); if not VirtualProtect(Address, Size, OldProtect, @OldProtect) then begin Fail; end; end;
  15. David Heffernan

    ShellExecute and passing of password

    You probably need to decide what you want to be secure from. As it stands it's probably impossible to give you specific advice.
  16. David Heffernan

    class constructor - Backport to D2007.

    Class vars are global variables inside a type's name's pace. Class constructors are called from unit initialization. Class destructor from unit finalization.
  17. David Heffernan

    Arab in iOS

    Firemonkey doesn't support right to left languages. Delphi is the wrong tool for you I am afraid.
  18. David Heffernan

    RttiContext Create and Free

    I don't follow that Stefan.
  19. David Heffernan

    Pointers... loops...

    Type delphi pointers into a search engine and start there. I'm sure there will be a mix of hits. Some better than others. Read the top 10, form a view on which are good and which are not. Reread the good ones.
  20. David Heffernan

    Pointers... loops...

    This has to be, in my opinion, one of the worst pieces of advice I have ever come across.
  21. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    It is the same if you do it right. You didn't. Your code set the popup parent to be the application handle. But we were previously talking about making the main form the popup parent. You even had a potldt claiming to have done this but then your code told a different story. It doesn't. Setting WndParent doesn't fix your issue. It is setting WndParent to be the application handle that changes the behaviour. The reason that it changes the behaviour is that with application handle as popup parent then the dialog is not made visible when the main form is made visible. But, as I have explained before, if the application handle is the popup parent then the system won't guarantee that the dialog is always in front of the main form. I think I've said this a few times before, but I do believe that it's important to understand what popup parent does, and why it is important. My advice to you is to do some research on what popup parent actually is and why it is important to set it, with particular focus on modal dialogs.
  22. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    There seems to be some confusion. You asked about why setting PopupParent to be the main form resulted in different behaviour from setting WndParent to the main form handle in CreateParams. However, the two example projects you provided did not differ in that way. In those projects the only difference is that one of them sets WndParent to be the application handle. And you'd expect different behaviour in that case.
  23. David Heffernan

    Pointers... loops...

    The API will be documented. It's essential that you use that documentation.
  24. David Heffernan

    RttiContext Create and Free

    You don't need to worry about even that because the dynamic memory associated with RTTI is ref counted and the refs will go to zero when the module is unloaded.
  25. David Heffernan

    Delphi 2007 to 10.3 and Windows 10 taskbar issue

    Perhaps you could provide a minimal example of these two variants so we can see exactly what you are doing.
×