我想使用 _beginthreadex 并传递一个字符串,即域的名称。通过它的正确方法/最佳实践是什么?
- 通过变量本身(sDomain)?
WCHAR sDomain[256] = {0};
//...copy domain into sDomain
UINT threadID = 0;
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &Thread_SaveDomainName, sDomain, 0, &threadID);
- 还是通过变量的地址(&sDomain)?
WCHAR sDomain[256] = {0};
//...copy domain into sDomain
UINT threadID = 0;
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &Thread_SaveDomainName, &sDomain, 0, &threadID);
- 还是我制作一个结构并传递结构元素(&sDomain[0])?
struct strDomain {TCHAR sDomain[256];};
strDomain *sDomain = new strDomain[1]();
//...copy domain into strDomain[0].sDomain
UINT threadID = 0;
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &Thread_SaveDomainName, &sDomain[0], 0, &threadID);