The first way: the value that will be passed is the address of the cast value, and then in the thread function, the type of the parameter is first coerced, and then the value DWORD WINAPI ThreadProc (LPVOID lpparam) { int i= (* (int*) lpparam); Get the parameter from CreateThread function CreateThread (NULL, Null ThreadProc, (LPVOID) i,********** 0, &dwthreadid); The second way: cast the parameter to LPVOID, in the thread function, cast to the appropriate type DWORD WINAPI ThreadProc (LPVOID lpparam) { int i= (int) lpparam); Get the parameter from CreateThread function CreateThread (NULL, Null ThreadProc, (LPVOID) &i,********** 0, &dwthreadid); Similarities and differences between the two points: A passing value, a pointer to the value, gets the pointer, and if the contents of the pointer are manipulated, it will affect the original variable that passed the value. |