MFC多线程的简单实现
2015-11-27 15:24
423 查看
// CGetLocalListenPortList 消息处理程序 BOOL CXxx::OnInitDialog() { CDialogEx::OnInitDialog(); //其它代码 //HWND hWnd=GetSafeHwnd();//获得窗口句柄 AfxBeginThread((AFX_THREADPROC)ThreadFunction,m_hWnd); //启动线程 return TRUE; } //线程函数,为静态成员函数 UINT CXxx::ThreadFunction(LPVOID pParam) { int i = 0; while(1) { if (i >= 200) { i = 0; } else { i++; } //int型转CString型 char buffer[100] = {0}; sprintf(buffer,"%d",i); TCHAR pid[100] = _T(""); mbstowcs(pid,buffer,100); CString csTemp(pid); } return 0; }
相关文章推荐
- Mysql索引
- [Struts]Struts2 - 常用的constant总结
- JavaScript中的dom编程
- 性能分析工具Eclipse Memory Analyzer tool(MAT)
- 阿里云服务器之hexo环境搭建
- 使用正则表达式给网址添加a标签
- Android之BroadcastReceiver的用法
- Unity3d选择本地图片并加载
- CocoaPods安装
- MySQLConnector/C++连接方式一
- 使用DBLINK查询时报ORA-00600: internal error code, arguments: [kzdlk_zt2 err]
- 去除jquery.min.map 404错误信息
- c++操作符重载操作
- 集合和泛型知识记录
- Problem executing commands on Windows over SSH
- Leetcode173: Add and Search Word - Data structure design
- Android之Intent 简介
- CentOS 设置快捷键启动Shell终端
- 安卓系统如何开启和关闭插入耳机时弹出的保护听力对话框
- 用 startActivityForResult 方法启动 Activity 的简单使用