随笔分类 -  VC

摘要:CSocket类中提供了一个虚拟函数,OnMessagePending.当Socket所在线程出现等待消息时,框架会调用该函数,让程序处理其它消息。这样就可以在实现该函数,以便快速退出程序了。代码如下:BOOL CSockClient::OnMesssagePending(){MSG msg;if(::PeekMessage(&msg,NULL,WM_QUIT,WM_QUIT,PM_NOR... 阅读全文
posted @ 2010-04-01 11:25 吾非无心 阅读(321) 评论(0) 推荐(0)
摘要:static DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb){ char *pstr = (char *)dwCookie; int nLen = strlen(pstr); if(nLen<cb) { CopyMemory(pbBuff,pstr,nLen); } e... 阅读全文
posted @ 2010-02-23 21:30 吾非无心 阅读(344) 评论(0) 推荐(0)
摘要://在OnCreate中添加 //设置正常字体 LOGFONT lf; afxGlobalData.fontRegular.GetLogFont(&lf); afxGlobalData.fontRegular.DeleteObject(); lf.lfHeight = -12; lstrcpy(lf.lfFaceName, _T("宋体")); // using without s... 阅读全文
posted @ 2010-02-16 16:24 吾非无心 阅读(516) 评论(0) 推荐(0)
摘要:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--//MyPipeServer.h:interfacefortheCMyPipeServerclass.////////////////////////////////////////////////... 阅读全文
posted @ 2009-11-29 16:14 吾非无心 阅读(571) 评论(0) 推荐(0)
摘要:VC之网页获取(能区分GB2312与UTF8) 阅读全文
posted @ 2009-11-29 16:08 吾非无心 阅读(623) 评论(0) 推荐(0)
摘要:void CRightFrame::OnWindowPosChanging(WINDOWPOS* lpwndpos){ lpwndpos->x -=2; lpwndpos->y -=2; lpwndpos->cx +=4; lpwndpos->cy +=4; CFrameWnd::OnWindowPosChanging(lpwndpos);}void CRightFrame... 阅读全文
posted @ 2009-11-14 11:13 吾非无心 阅读(709) 评论(0) 推荐(0)
摘要:在类1中定义回调函数[代码]回调函数的实现[代码]在类1中还要在适当地方,将回调函数的地址传给类2实例:Initialize(NotifyProc)在类2 中先定义typedef void (CALLBACK* NOTIFYPROC)(LPVOID, ClientContext*, UINT nCode);//参数类型必须与类1中回调函数类型完全一致[代码]在类2中将类1实例传来的回调函数地址指定... 阅读全文
posted @ 2009-10-22 22:49 吾非无心 阅读(1104) 评论(0) 推荐(0)
摘要:头文件[代码]CPP实现文件:[代码]使用示例:...#include "MyServiceStatus.h"class CNTServCtrlDlg : public CDialog{...private:CMyServiceStatus m_MyServiceStatus;}////////////////////////////////////////////////////////////... 阅读全文
posted @ 2009-10-20 11:47 吾非无心 阅读(243) 评论(0) 推荐(0)