lianDlg.cpp
#include "lmain.h" void ClianDlg::OnBnClickedButton1() { // TODO: 在此添加控件通知处理程序代码 CWinThread *m_edit; m_edit=AfxBeginThread(lmain,&(m_hWnd),THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED,NULL); m_edit->m_bAutoDelete=TRUE; m_edit->ResumeThread(); }
lmain.h
UINT lmain(LPVOID lpParam);
lmain.cpp
#include "stdafx.h" #include "lian.h" #includeUINT lmain(LPVOID lpParam) { HWND mainwnd=*((HWND*)lpParam); HWND hwnd=::FindWindow(NULL,_T("lian")); CString str; str="111dfgdfgdfgd11"; ::SendDlgItemMessage(hwnd,IDC_EDIT1,WM_SETTEXT,0,(LPARAM)str.GetBuffer(str.GetLength())); //SendMessage(mainwnd,WM_CLOSE,NULL,NULL); return 0; }