上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: 参考博客:http://blog.csdn.net/morewindows/article/details/7429155本想以该博客的指示编写程序找出漏洞,但是却没有发现异常//创建多子个线程实例#include <stdio.h>#include <process.h>#include <windows.h>volatile long g_nLoginCount=0; //登录次数 const int THREAD_NUM = 55; //启动线程数 //子线程函数unsigned int __stdcall ThreadFun1(PVOID pM){ 阅读全文
posted @ 2013-04-15 11:59 qq921201008 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 参考文章:http://blog.csdn.net/morewindows/article/details/7392749CreateThread:函数原型HANDLEWINAPICreateThread( LPSECURITY_ATTRIBUTESlpThreadAttributes,/ SIZE_TdwStackSize,LPTHREAD_START_ROUTINElpStartAddress, LPVOIDlpParameter, DWORDdwCreationFlags, LPDWORDlpThreadId);第一个参数:内核对象安全属性,一般用null来默认设置第二个参数:表示线程栈 阅读全文
posted @ 2013-04-12 15:25 qq921201008 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 次程序只能实现一问一答的模式聊天,要实现随机性聊天貌似要用到线程参考资料http://www.cnblogs.com/qxhcpp/archive/2012/04/27/2473756.html服务端:#include <Winsock2.h>#include <stdio.h>void main(){ WORD wVersionRequested;//定义一个word类型的变量 WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 1, 1 ); err = WSAStartup( wVersionReq... 阅读全文
posted @ 2013-04-12 11:06 qq921201008 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 1.使用之前必须链接库函数 工程--设置--Link--输入ws2_32.lib 服务端函数编程#include <Winsock2.h> #include <stdio.h> #include <memory.h>void main() { WORD wVersionRequested; //保存要加载winsock的版本号 WSADATA wsaData; int err; //通过MAKEWORD获得要加载的winsock的版本 wVersionRequested = MAKEWORD( 1, 1 ); //加载套接字库,确定要使用到socket版本 阅读全文
posted @ 2013-04-11 12:49 qq921201008 阅读(206) 评论(0) 推荐(0) 编辑
摘要: void CTxtView::OnFileWrite() {// TODO: Add your command handler code hereCFile file("c:\\1.txt",CFile::modeCreate||CFile::modeWrite);CArchive ar(&file,CArchive::store);CString str="123";//ar<<str;//ar.Flush();file.Write("123",3);ar.Close();file.Close();}void C 阅读全文
posted @ 2013-04-06 11:40 qq921201008 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 今日用CArchive练习流输入,不料输出结果有差异,未查明原因,特此记录void CTxtView::OnFileWrite() {// TODO: Add your command handler code hereCFile file("c:\\1.txt",CFile::modeCreate||CFile::modeWrite);CArchive ar(&file,CArchive::store);CString str="123";ar<<str; ar.Flush();//file.Write("123" 阅读全文
posted @ 2013-04-06 11:33 qq921201008 阅读(144) 评论(0) 推荐(0) 编辑
摘要: CFileException类的声明文件保存在头文件afx.h中。当我们在使用CFile及其派生类的对象的时候,如果产生异常则会创建和抛出CFileException对象。采用TRY…CATCH…END_CATCH。CFileException类的成员变量:m_cause:错误代码CFileException::none没有错误发生CFileException::generic一个未被指明的错误发生CFileException::fileNotFind该文件不能被定位CFileException::badPath整个或者部分路径是无效的CFileException::tooManyOpenFi 阅读全文
posted @ 2013-04-06 10:27 qq921201008 阅读(2365) 评论(0) 推荐(0) 编辑
摘要: 1) 在 View 中获得 Doc 指针 CYouSDIDoc *pDoc=GetDocument();一个视只能有一个文档。2) 在App 中获得MainFrame 指针 CWinApp 中的 m_pMainWnd 变量就是 MainFrame 的指针也可以: CMainFrame *pMain =(CMainFrame *)AfxGetMainWnd();3) 在 View 中获得 MainFrame 指针 CMainFrame *pMain=(CmaimFrame*)AfxGetApp()->m_pMainWnd;4) 获得 View (已建立)指针CMainFrame *pMai 阅读全文
posted @ 2013-04-05 10:15 qq921201008 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 一.创建插入符1, 添加 View类的 WM_CREATE 消息响应函数 2, 在 CXXXView::OnCreate()中添加 //获得当前文本度量/字体信息 CClientDC dc(this); TEXTMETRIC tm; dc.GetTextMetrics(&tm); //根据当前字体,设置插入符/光标 CreateSolidCaret(20,100); //** ShowCaret();二.创建图形插入符1),为 View类添加成员变量 m_bmp; 2),把上面的**行用如下语句替换 m_bmp.LoadBitmap(IDB_BITMAP1); CreateCaret( 阅读全文
posted @ 2013-04-04 00:06 qq921201008 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 1.利用画笔改变线条颜色和类型: CPen pen(PS_DOT,1,RGB(0,255,0));//构造画笔对象 CClientDC dc(this);CPen *pOldPen=dc.SelectObject(&pen);//将画笔选入 DC dc.MoveTo(m_ptOrigin); dc.LineTo(point); dc.SelectObject(pOldPen);//恢复先前的画笔2.使用画刷(通常利用画刷去填充矩形区域): 使用单色画刷 CBrush brush(RGB(255,0,0));//构造画刷对象 CClientDC dc(this); dc.FillRect 阅读全文
posted @ 2013-03-24 17:55 qq921201008 阅读(536) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 下一页