AfxBeginThread创建线程问题
A.h程序代码:
typedef struct tagTEST { int hwnd; __int8 A; __int8 B; __int8 C; char *D; char *E; char *F; }THREAD_PARAM, *LPTHREAD_PARAM;
B.cpp
程序代码:
extern UINT MyThreadFun( LPVOID lpParam ); int _stdcall ST2MG(int hwnd,__int8 A, __int8 B,__int8 C, char *D, char *E, char *F) { LPTHREAD_PARAM lpParam = new THREAD_PARAM; lpParam->hwnd = hwnd; lpParam->A= A; lpParam->B= B; lpParam->C=C; lpParam->D=D; lpParam->E=E; lpParam->F=F; ::AfxBeginThread(MyThreadFun, lpParam); //delete lpParam1; return 1; } UINT MyThreadFun (LPVOID lpParam) { LPTHREAD_PARAM lpParam1 = (LPTHREAD_PARAM)lpParam; THREAD_PARAM stParam; stParam.hwnd= lpParam1->hwnd; stParam.A= lpParam1->A; stParam.B= lpParam1->B; stParam.C= lpParam1->C; stParam.D= lpParam1->D; stParam.E= lpParam1->E; stParam.F= lpParam1->F; .....
这样写有什么问题吗?
编译是没有错误,但是运行后却会出现错误~
关于行程建立有什么地方没写到吗?