M
M
mIka012021-09-29 23:45:13
C++ / C#
mIka01, 2021-09-29 23:45:13

How to call CreateThread inside a Form?

Hello, I have a question due to ignorance of the programming language.
I can't figure out how to call a function CreateThreadinside a Form .
The called line looks like this.

CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ClientHandler_second, NULL, NULL, NULL);


The function itself looks like this. My assumption is that I just declare the function in the wrong place. How can I call a thread and declare a function without error? Thank you in advance. void ClientHandler_second() { ... }


Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2021-09-30
@mIka01

Tony is right, but there is one more thing.
CreateThread must NOT be used. More precisely, you can - but for this you need to know what you are doing. And so for the application program, the rule is that you need to transfer the runtime library to multithreaded mode, and for this, call an analog from this very library. In C++, the beginthreadex() function is used for this, in Delphi - BeginThread.

T
Tony, 2021-09-29
@AntonSazonov

https://docs.microsoft.com/en-us/previous-versions... "
The thread function prototype looks like this:
DWORD WINAPI ThreadProc( LPVOID lpParameter );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question