I create a Windows timer using the following
FHandle := SetTimer(0, 0, 1000, TFNTimerProc(@TMyClass.MyMethod));
Is this thread shown in the Delphi “Threads” window. If Yes how I can get this Thread ID?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no thread created by that function. The OS calls the callback function when your program handles the
wm_Timermessage. It’s called from within the context of the same thread that calledSetTimer, so the thread had better have a message pump. (It you’re calling this from the main VCL thread, then the message pump is provided for you by theTApplicationclass.)Furthermore,
SetTimerdoesn’t return a handle. It returns a timer ID.And finally, unless that method is a
class staticmethod, it won’t work the way you hope. If the signature of the callback matches whatSetTimerexpects you to provide, you won’t need a type cast, so if you needed to type-cast the function pointer to make the compiler accept your code, you probably got it wrong.