向线程投递消息PostThreadMessage
来源:互联网 发布:三层网络 编辑:程序博客网 时间:2024/04/29 03:24
1 #define WM_MYMSG1 WM_USER+1 2 #define WM_MYMSG2 WM_USER+2 3 4 HANDLE hThread; 5 //DWORD threadID1; 6 UINT threadID2; 7 8 //hThread=::CreateThread(NULL,0,lpFun,this,NULL,&threadID1); 9 hThread=(HANDLE)_beginthreadex( NULL, 0, &lpFun, NULL, NULL, &threadID2);//创建并启动线程10 11 12 char * str="post message";13 PostThreadMessage(threadID1,WM_MYMSG1,(WPARAM)str,0);//向线程投递消息14 15 16 17 UINT __stdcall lpFun(LPVOID lParam)18 {19 MSG msg;20 PeekMessage(&msg, NULL, NULL, NULL,NULL);21 while(TRUE)22 {23 if(GetMessage(&msg,0,0,0)) //get msg from message queue24 {25 char *str=(char*)msg.wParam;26 CString strTemp=str;27 switch(msg.message)28 {29 case WM_MYMSG1:AfxMessageBox(strTemp);30 ;break;31 case WM_MYMSG2:AfxMessageBox("2");break;32 }33 } 34 }35 return 1;36 }
- 向线程投递消息PostThreadMessage
- 向线程函数内投递消息CWinThread::PostThreadMessage
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向工作线程发送消息
- 使用PostThreadMessage向发送线程消息失败的解决方法
- PostThreadMessage 线程的消息
- PostThreadMessage window线程间传送消息
- 使用PostThreadMessage在Win32线程间传递消息
- 使用PostThreadMessage在Win32线程间传递消息
- 使用PostThreadMessage在Win32线程间传递消息
- 使用PostThreadMessage在Win32线程间传递消息
- 使用PostThreadMessage在Win32线程间传递消息 (zhuan)
- 使用PostThreadMessage在Win32线程间传递消息
- windows常用消息1
- c++实现双链表
- 堆栈的区别
- 套接字
- MFC数组的使用
- 向线程投递消息PostThreadMessage
- 内存文件映射
- 开机启动
- 注册表
- 文件拖拽
- 临界区
- Windows API ——CreateMutex——创建互斥对象
- Windows API——CreateEvent——创建事件
- 互斥对象、事件对象、关键代码段的应用和比较