Page 1 of 1

Thread Description

Posted: Mon Feb 15, 2021 1:18 pm
by frogb
It would be really helpful to have thread descriptions available in bugreport.txt.

I can set this using the Windows 10 API:
https://docs.microsoft.com/en-us/window ... escription

Where in the MadExcept source code is the best place a place to add GetThreadDescription to display it alongside the Thread ID ?

Re: Thread Description

Posted: Mon Feb 15, 2021 5:47 pm
by frogb
I have now found SetThreadInfo and made a change to add it to the implementation section of madExcept.pas so that I can call it after creating threads. The ones I need to show in bugreport.txt are actually created in a Microsoft C DLL which can already call some functions in the main Delphi program. This works well!

Re: Thread Description

Posted: Mon Feb 15, 2021 6:20 pm
by madshi
There's already an API exported by madExcept.pas called "NameThread()":

Code: Select all

// to make the bug report more readable, you can name your secondardy threads
procedure NameThread (threadId: dword; const threadName: UnicodeString);
Internally it calls "SetThreadInfo".

Re: Thread Description

Posted: Tue Feb 16, 2021 2:26 pm
by frogb
Thanks, that's easier!