多线程 关于FindWindow,SendMessage和_beginthread的
程序代码如下:
CTestDlg.cpp
void CTestDlg::OnButtonStart
{
int x;
HANDLE hThtread = (HANDLE)_beginthread(threadFunc, 0, x);
::WaitForSingleObject(hThtread, INFINITE);
}
void CTestDlg::threadFunc(void* lParam)
{
EVF_DATASET1 data;
CWnd m_hWnd = ::FindWindow(NULL, "测试"); //出错1
if (m_hWnd !=NULL) //出错2
{
::SendMessage(m_hWnd, WM_USER_EVF_DATA_CHANGED, (WPARAM) &data, NULL);
........
}
_endthread();
}
CTestDlg.h
public:
void static threadFunc(void* lParam);
编译的时候有两个错误:
1. error C2248: “CWnd::CWnd”: 无法访问 private 成员(在“CWnd”类中声明)
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(2824) : 参见“CWnd::CWnd”的声明
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(1967) : 参见“CWnd”的声明
2. error C2666: “CWnd::operator !=”: 2 个重载有相似的转换
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(1978): 可能是“BOOL CWnd::operator !=(const CWnd &) const”
或“内置 C++ operator!=(HWND, HWND)”
试图匹配参数列表“(CWnd, int)”时
等待您的回答,因为是新手,不太会,也差了很多资料,但是没有得到更好的解决,还是有这两个错误