﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Welcome to ErranLi's Blog!-随笔分类-MFC</title><link>http://www.cppblog.com/erran/category/5347.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 01 Jul 2011 07:08:53 GMT</lastBuildDate><pubDate>Fri, 01 Jul 2011 07:08:53 GMT</pubDate><ttl>60</ttl><item><title>Invalidate和UpdateWindow的区别</title><link>http://www.cppblog.com/erran/archive/2011/07/01/149901.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Fri, 01 Jul 2011 05:55:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2011/07/01/149901.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/149901.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2011/07/01/149901.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/149901.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/149901.html</trackback:ping><description><![CDATA[<div>Invalidate和UpdateWindow的区别<br />Invalidate在消息队列中加入一条WM_PAINT消息，其无效区为整个客户区。<br />UpdateWindow直接发送一个WM_PAINT消息，其无效区范围就是消息队列中WM_PAINT消息（最多只有一条）的无效区。<br />效果很明显，当调用Invalidate之后，屏幕不一定马上更新，因为WM_PAINT消息不一定在队列头部，而调用UpdateWindow会使WM_PAINT消息马上执行的，绕过了消息队列。<br />如果调用Invalidate之后想马上更新屏幕，那就加上UpdateWindow()这条语句。 </div>
<div>MSDN的解释 <br />UpdateWindow <br />The UpdateWindow function updates the client area of the specified window by sending a WM_PAINT </div>
<div>message to the window if the window's update region is not empty. The function sends a WM_PAINT</div>
<div>message directly to the window procedure of the specified window, bypassing the application queue. </div>
<div>If the update region is empty, no message is sent. </div>
<div>InvalidateRect <br />The system sends a WM_PAINT message to a window whenever its update region is not empty and</div>
<div>there are no other messages in the application queue for that window. </div>
<div>翻译成中文大概的解释如下： <br />UpdateWindow：如果有无效区，则马上sending a WM_PAINT message到窗口处理过程，不进消息队列进行排队等待，立即刷新窗口，否则，什么都不做。 <br />InvalidateRect：设置无效区，如果为NULL参数，则设置整个窗口为无效区。当应用程序的那个窗口的消息队列为空时，则sending a WM_PAINT message(即使更新区域为空).在sending a WM_PAINT message的所有InvalidateRect的更新区域会累加。 <br /></div>
<div>1:设置无效区 <br />InvalidateRect </div>
<div>2：立即刷新 <br />UpdateWindow(); </div>
<div>如果不调用 InvalidateRect就调用 UpdateWindow，那么UpdateWindow什么都不做。 ??????<br />如果调用 InvalidateRect 后不调用UpdateWindow，则系统会自动在窗口消息队列为空的时候，系统自动发送一WM_PAINT消息。 <br /></div>
<div>调用UpdateWindow()时将会发送一个WM_PAINT消息，而应用程序在接收到WM_PAINT消息后，将自动地调用Invalidate(),所以，在程序代码中，不一定要出现Invalidate()!</div>
<div>UpdateWindow()就是立即发送WM_PAINT消息,只对声明无效的区域起作用， <br />Invalidate()则是声明无效的方式之一。</div>
<div>Invalidate()表示客户区域无效，在下次WM_PAINT发生时重绘。而WM_PAINT是由系统进行维护的，每当CWnd的更新区域不为空，并且在应用程序的窗口消息队列中没有其它消息时，Windows就发送一条WM_PAINT消息。 <br />Invalidate里面有个bool型的参数，用来标识重绘的时候是否用背景色填充。是不是用SetBkcolor函数？下去继续研究。</div>
<div>updateWindow则是要求系统对区域进行立即重绘。</div>
<div>看到有人在网上提出问题，他在Invalidate后面又写了绘图的函数但是没有执行，因为invalidate执行过以后转到PAINT命令了。所以后面的都没有显示。</div>
<div>也终于想通我绘的图一直在闪啊闪，因为我在PAINT里面用到Invalidate()函数，所以他不停的自嵌套，倒是绘的图不停的闪。</div>
<div></div>
<div>Invalidate让客户区处于可以重画的状态，而UpdateWindow开始重画，但是它先判断客户区是否为空，不空UpdateWindow不执行，为空才执行重画。</div>
<div></div>
<div>Invalidat最后也是调用InvalidatRect,在windows API里只有InvalidatRect的</div><img src ="http://www.cppblog.com/erran/aggbug/149901.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2011-07-01 13:55 <a href="http://www.cppblog.com/erran/archive/2011/07/01/149901.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC中的一些常用方法</title><link>http://www.cppblog.com/erran/archive/2007/10/14/34185.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 16:38:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/14/34185.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34185.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/14/34185.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34185.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34185.html</trackback:ping><description><![CDATA[
		<font face="Arial">
				<br />
				<strong>一、打开CD-ROM <br /></strong>mciSendString("Set cdAudio door open wait",NULL,0,NULL); <br /><br /><strong>二、关闭CD_ROM</strong> <br />mciSendString("Set cdAudio door closed wait",NULL,0,NULL); <br /><br /><strong>三、关闭计算机 <br /></strong>OSVERSIONINFO OsVersionInfo; //包含操作系统版本信息的数据结构 <br />OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); <br />GetVersionEx(&amp;OsVersionInfo); //获取操作系统版本信息 <br />if(OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) <br />{ <br />//Windows98,调用ExitWindowsEx()函数重新启动计算机 <br /><br />DWORD dwReserved; <br />ExitWindowsEx(EWX_REBOOT,dwReserved); //可以改变第一个参数，实现注销用户、 <br />//关机、关闭电源等操作 <br />// 退出前的一些处理程序 <br />} <br /><br /><strong>四、重启计算机 <br /></strong>typedef int (CALLBACK *SHUTDOWNDLG)(int); //显示关机对话框函数的指针 <br />HINSTANCE hInst = LoadLibrary("shell32.dll"); //装入shell32.dll <br />SHUTDOWNDLG ShutDownDialog; //指向shell32.dll库中显示关机对话框函数的指针 <br />if(hInst != NULL) <br />{ <br />//获得函数的地址并调用之 <br />ShutDownDialog = (SHUTDOWNDLG)GetProcAddress(hInst,(LPSTR)60); <br /><br />(*ShutDownDialog)(0); <br />} <br /><br /><strong>五、枚举所有字体 <br /></strong>LOGFONT lf; <br />lf.lfCharSet = DEFAULT_CHARSET; // Initialize the LOGFONT structure <br />strcpy(lf.lfFaceName,""); <br />CClientDC dc (this); <br />// Enumerate the font families <br />::EnumFontFamiliesEx((HDC) dc,&amp;lf,                                                                                       <br />(FONTENUMPROC) EnumFontFamProc,(LPARAM) this,0); <br />//枚举函数 <br />int CALLBACK EnumFontFamProc(LPENUMLOGFONT lpelf, <br />LPNEWTEXTMETRIC lpntm,DWORD nFontType,long lparam) <br /><br />{ <br />// Create a pointer to the dialog window <br />CDay7Dlg* pWnd = (CDay7Dlg*) lparam; <br />// add the font name to the list box <br />pWnd -&gt;m_ctlFontList.AddString(lpelf -&gt;elfLogFont.lfFaceName); <br />// Return 1 to continue font enumeration <br />return 1; <br />} <br />其中m_ctlFontList是一个列表控件变量 <br /><br /><strong>六、一次只运行一个程序实例，如果已运行则退出</strong> <br />if( FindWindow(NULL,"程序标题")) exit(0); <br /><br /><strong>七、得到当前鼠标所在位置</strong> <br />CPoint pt; <br />GetCursorPos(&amp;pt); //得到位置 <br /><br /><strong>八、上下文菜单事件触发事件：OnContextMenu事件 <br /></strong><br /><strong>九、显示和隐藏程序菜单 <br /></strong>CWnd *pWnd=AfxGetMainWnd(); <br />if(b_m) //隐藏菜单 <br />{ <br />pWnd-&gt;SetMenu(NULL); <br />pWnd-&gt;DrawMenuBar(); <br />b_m=false; <br />} <br />else <br />{ <br />CMenu menu; <br />menu.LoadMenu(IDR_MAINFRAME); ////显示菜单 也可改变菜单项 <br />pWnd-&gt;SetMenu(&amp;menu); <br />pWnd-&gt;DrawMenuBar(); <br />b_m=true; <br />menu.Detach(); <br />} <br /><br /><strong>十、获取可执行文件的图标</strong> <br />HICON hIcon=::ExtractIcon(AfxGetInstanceHandle(),_T("NotePad.exe"),0); <br />if (hIcon &amp;&amp;hIcon!=(HICON)-1) <br />{ <br />pDC-&gt;DrawIcon(10,10,hIcon); <br /><br />} <br />DestroyIcon(hIcon); <br /><br /><strong>十一、窗口自动靠边程序演示</strong> <br />BOOL AdjustPos(CRect* lpRect) <br />{//自动靠边 <br />int iSX=GetSystemMetrics(SM_CXFULLSCREEN); <br />int iSY=GetSystemMetrics(SM_CYFULLSCREEN); <br />RECT rWorkArea; <br />BOOL bResult = SystemParametersInfo(SPI_GETWORKAREA, sizeof(RECT), &amp;rWorkAre <br />a, 0); <br />CRect rcWA; <br />if(!bResult) <br />{//如果调用不成功就利用GetSystemMetrics获取屏幕面积 <br />rcWA=CRect(0,0,iSX,iSY); <br />} <br />else <br />rcWA=rWorkArea; <br />int iX=lpRect-&gt;left; <br />int iY=lpRect-&gt;top; <br /><br />if(iX &lt; rcWA.left + DETASTEP &amp;&amp; iX!=rcWA.left) <br />{//调整左 <br />//pWnd-&gt;SetWindowPos(NULL,rcWA.left,iY,0,0,SWP_NOSIZE); <br />lpRect-&gt;OffsetRect(rcWA.left-iX,0); <br />AdjustPos(lpRect); <br />return TRUE; <br />} <br />if(iY &lt; rcWA.top + DETASTEP &amp;&amp; iY!=rcWA.top) <br />{//调整上 <br />//pWnd-&gt;SetWindowPos(NULL ,iX,rcWA.top,0,0,SWP_NOSIZE); <br />lpRect-&gt;OffsetRect(0,rcWA.top-iY); <br />AdjustPos(lpRect); <br />return TRUE; <br />} <br />if(iX + lpRect-&gt;Width() &gt; rcWA.right - DETASTEP &amp;&amp; iX !=rcWA.right-lpRect-&gt;W <br /><br />idth()) <br />{//调整右 <br />//pWnd-&gt;SetWindowPos(NULL ,rcWA.right-rcW.Width(),iY,0,0,SWP_NOSIZE); <br />lpRect-&gt;OffsetRect(rcWA.right-lpRect-&gt;right,0); <br />AdjustPos(lpRect); <br />return TRUE; <br />} <br />if(iY + lpRect-&gt;Height() &gt; rcWA.bottom - DETASTEP &amp;&amp; iY !=rcWA.bottom-lpRect <br />-&gt;Height()) <br />{//调整下 <br />//pWnd-&gt;SetWindowPos(NULL ,iX,rcWA.bottom-rcW.Height(),0,0,SWP_NOSIZE); <br />lpRect-&gt;OffsetRect(0,rcWA.bottom-lpRect-&gt;bottom); <br />return TRUE; <br />} <br />return FALSE; <br />} <br />//然后在ONMOVEING事件中使用所下过程调用 <br /><br />CRect r=*pRect; <br />AdjustPos(&amp;r); <br />*pRect=(RECT)r; <br /><br /><strong>十二、给系统菜单添加一个菜单项 <br /></strong>给系统菜单添加一个菜单项需要进行下述三个步骤： <br />首先，使用Resource Symbols对话（在View菜单中选择Resource Symbols．．．可以显 <br />示该对话）定义菜单项ID，该ID应大于0x0F而小于0xF000； <br />其次，调用CWnd::GetSystemMenu获取系统菜单的指针并调用CWnd:: Appendmenu将菜单 <br />项添加到菜单中。下例给系统菜单添加两个新的 <br />int CMainFrame:: OnCreate (LPCREATESTRUCT lpCreateStruct) <br />{ <br />… <br />//Make sure system menu item is in the right range. <br /><br />ASSERT(IDM_MYSYSITEM&lt;0xF000); <br />//Get pointer to system menu. <br />CMenu* pSysMenu=GetSystemMenu(FALSE); <br />ASSERT_VALID(pSysMenu); <br />//Add a separator and our menu item to system menu. <br />CString StrMenuItem(_T ("New menu item")); <br />pSysMenu-&gt;AppendMenu(MF_SEPARATOR); <br />pSysMenu-&gt;AppendMenu(MF_STRING, IDM_MYSYSITEM, StrMenuItem); <br />… <br />} <br /><br /><strong>十三、运行其它程序</strong> <br />//1、运行EMAIL或网址 <br />char szMailAddress[80]; <br />strcpy(szMailAddress,"mailto:netvc@21cn.com"); <br />ShellExecute(NULL, "open", szMailAddress, NULL, NULL, SW_SHOWNORMAL); <br /><br />//2、运行可执行程序 <br />WinExec("notepad.exe",SW_SHOW); //运行计事本 <br /><br /><strong>十四、动态增加或删除菜单 <br /></strong>1、 增加菜单 <br />//添加 <br />CMenu *mainmenu; <br />mainmenu=AfxGetMainWnd()-&gt;GetMenu(); //得到主菜单 <br />(mainmenu-&gt;GetSubMenu (0))-&gt;AppendMenu (MF_SEPARATOR);//添加分隔符 <br />(mainmenu-&gt;GetSubMenu (0))-&gt;AppendMenu(MF_STRING,ID_APP_ABOUT,_T("Always on <br />&amp;Top")); //添加新的菜单项 <br />DrawMenuBar(); //重画菜单 <br />2、 删除菜单 <br />//删除 <br />CMenu *mainmenu; <br />mainmenu=AfxGetMainWnd()-&gt;GetMenu(); //得到主菜单 <br /><br />CString str ; <br />for(int i=(mainmenu-&gt;GetSubMenu (0))-&gt;GetMenuItemCount()-1;i&gt;=0;i--) //取得菜 <br />单的项数。 <br />{ <br />(mainmenu-&gt;GetSubMenu (0))-&gt;GetMenuString(i,str,MF_BYPOSITION); <br />//将指定菜单项的标签拷贝到指定的缓冲区。MF_BYPOSITION的解释见上。 <br />if(str=="Always on &amp;Top") //如果是刚才我们增加的菜单项，则删除。 <br />{ <br />(mainmenu-&gt;GetSubMenu (0))-&gt;DeleteMenu(i,MF_BYPOSITION); <br />break; <br />} <br /><br /><strong>十五、改变应用程序的图标</strong> <br />静态更改： 修改图标资源IDR_MAINFRAME。它有两个图标，一个是16*16的，另一个是3 <br /><br />2*32的，注意要一起修改。 <br />动态更改： 向主窗口发送WM_SETICON消息.代码如下： <br />HICON hIcon=AfxGetApp()-&gt;LoadIcon(IDI_ICON); <br />ASSERT(hIcon); <br />AfxGetMainWnd()-&gt;SendMessage(WM_SETICON,TRUE,(LPARAM)hIcon); <br /><br /><strong>十六、另一种改变窗口标题的方法</strong> <br />使用语句 CWnd* m_pCWnd = AfxGetMainWnd( )，然后，再以如下形式调用SetWindowTe <br />xt()函数： <br />SetWindowText( *m_pCWnd,(LPCTSTR)m_WindowText)；// m_WindowText可以是一个CSt <br />ring类的变量。 <br /><br /><strong>十七、剪切板上通过增强元文件拷贝图像数据 <br /></strong>下面代码拷贝通过元文件拷贝图像数据到任何应用程序，其可以放置在CView派生类的函 <br /><br />数中。 <br />CMetaFileDC * m_pMetaDC = new CMetaFileDC(); <br />m_pMetaDC-&gt;CreateEnhanced(GetDC(),NULL,NULL,"whatever"); <br />//draw meta file <br />//do what ever you want to do: bitmaps, lines, text... <br />//close meta file dc and prepare for clipboard; <br />HENHMETAFILE hMF = m_pMetaDC-&gt;CloseEnhanced(); <br />//copy to clipboard <br />OpenClipboard(); <br />EmptyClipboard(); <br />::SetClipboardData(CF_ENHMETAFILE,hMF);                                                                                 <br />CloseClipboard(); <br /><br />//DeleteMetaFile(hMF); <br />delete m_pMetaDC; <br /><br /><strong>十八、剪切板上文本数据的传送</strong> <br />把文本放置到剪接板上： <br />CString source; <br />//put your text in source <br />if(OpenClipboard()) <br />{ <br />HGLOBAL clipbuffer; <br />char * buffer; <br />EmptyClipboard(); <br />clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength()+1); <br />buffer = (char*)GlobalLock(clipbuffer); <br />strcpy(buffer, LPCSTR(source)); <br />GlobalUnlock(clipbuffer); <br />SetClipboardData(CF_TEXT,clipbuffer); <br />CloseClipboard(); <br />} <br />从剪接板上获取文本： <br /><br />char * buffer; <br />if(OpenClipboard()) <br />{ <br />buffer = (char*)GetClipboardData(CF_TEXT); <br />//do something with buffer here <br />//before it goes out of scope <br />} <br />CloseClipboard(); <br /><br /><strong>十九、将捕捉屏幕图像到剪切版中 <br /></strong>void CShowBmpInDlgDlg::OnCutScreen() <br />{ <br />ShowWindow(SW_HIDE); <br />RECT r_bmp={0,0,::GetSystemMetrics(SM_CXSCREEN), <br />::GetSystemMetrics(SM_CYSCREEN)};                                                                                       <br />HBITMAP hBitmap; <br />hBitmap=CopyScreenToBitmap(&amp;r_bmp); <br /><br />//hWnd为程序窗口句柄 <br />if (OpenClipboard()) <br />{ <br />EmptyClipboard(); <br />SetClipboardData(CF_BITMAP, hBitmap); <br />CloseClipboard(); <br />} <br />ShowWindow(SW_SHOW); <br />} <br />HBITMAP CShowBmpInDlgDlg::CopyScreenToBitmap(LPRECT lpRect) <br />{ <br />//lpRect 代表选定区域 <br />{ <br />HDC hScrDC, hMemDC; <br />// 屏幕和内存设备描述表 <br />HBITMAP hBitmap, hOldBitmap; <br />// 位图句柄 <br />int nX, nY, nX2, nY2; <br />// 选定区域坐标 <br />int nWidth, nHeight; <br />// 位图宽度和高度 <br />int xScrn, yScrn; <br />// 屏幕分辨率 <br /><br />// 确保选定区域不为空矩形 <br />if (IsRectEmpty(lpRect)) <br />return NULL; <br />//为屏幕创建设备描述表 <br />hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); <br />//为屏幕设备描述表创建兼容的内存设备描述表 <br />hMemDC = CreateCompatibleDC(hScrDC); <br />// 获得选定区域坐标 <br />nX = lpRect-&gt;left; <br />nY = lpRect-&gt;top; <br />nX2 = lpRect-&gt;right; <br />nY2 = lpRect-&gt;bottom; <br />// 获得屏幕分辨率 <br />xScrn = GetDeviceCaps(hScrDC, HORZRES); <br />yScrn = GetDeviceCaps(hScrDC, VERTRES); <br />//确保选定区域是可见的 <br />if (nX&lt;0) <br /><br />nX = 0; <br />if (nY&lt;0) <br />nY = 0; <br />if (nX2&gt;xScrn) <br />nX2 = xScrn; <br />if (nY2&gt;yScrn) <br />nY2 = yScrn; <br />nWidth = nX2 - nX; <br />nHeight = nY2 - nY; <br />// 创建一个与屏幕设备描述表兼容的位图 <br />hBitmap = CreateCompatibleBitmap <br />(hScrDC, nWidth, nHeight); <br />// 把新位图选到内存设备描述表中 <br />hOldBitmap =(HBITMAP)SelectObject(hMemDC, hBitmap); <br />// 把屏幕设备描述表拷贝到内存设备描述表中 <br />BitBlt(hMemDC, 0, 0, nWidth, nHeight, <br />hScrDC, nX, nY, SRCCOPY); <br />//得到屏幕位图的句柄 <br />hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap); <br /><br />//清除 <br />DeleteDC(hScrDC); <br />DeleteDC(hMemDC); <br />// 返回位图句柄 <br />return hBitmap; <br />} <br />} <br /><br /><strong>二十、如何将位图缩放显示在Static控件中 <br /></strong>//在Staic控件内显示位图 <br />void CShowBmpInDlgDlg::ShowBmpInStaic() <br />{ <br />CBitmap hbmp; <br />HBITMAP hbitmap; <br />//将pStatic指向要显示的地方 <br />CStatic *pStaic; <br />pStaic=(CStatic*)GetDlgItem(IDC_IMAGE); <br />//装载资源 MM.bmp是我的一个文件名，用你的替换 <br />hbitmap=(HBITMAP)::LoadImage (::AfxGetInstanceHandle(),"MM.bmp", <br />IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); <br /><br />hbmp.Attach(hbitmap); <br />//获取图片格式 <br />BITMAP bm; <br />hbmp.GetBitmap(&amp;bm); <br />CDC dcMem; <br />dcMem.CreateCompatibleDC(GetDC()); <br />CBitmap *poldBitmap=(CBitmap*)dcMem.SelectObject(hbmp); <br />CRect lRect; <br />pStaic-&gt;GetClientRect(&amp;lRect); <br />//显示位图 <br />pStaic-&gt;GetDC()-&gt;StretchBlt(lRect.left ,lRect.top ,lRect.Width(),lRect.Heigh <br />t(), <br />&amp;dcMem,0 ,0,bm.bmWidth,bm.bmHeight,SRCCOPY); <br />dcMem.SelectObject(&amp;poldBitmap); <br />}<br /></font>
<img src ="http://www.cppblog.com/erran/aggbug/34185.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-14 00:38 <a href="http://www.cppblog.com/erran/archive/2007/10/14/34185.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转：如何在同一个工程里添加多种语言 </title><link>http://www.cppblog.com/erran/archive/2007/10/13/34149.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 13:24:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34149.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34149.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34149.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34149.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34149.html</trackback:ping><description><![CDATA[
		<span style="font-size: 11pt;" lang="EN-US">
		</span> 原文：http://dev.csdn.net/article/23/23538.shtm<br />作者： <span style="font-size: 11pt;" lang="EN-US"></span><span style="font-size: 11pt;" lang="EN-US"></span> <span style="font-size: 11pt;"><span lang="EN-US"><o:p></o:p></span></span> <span style="font-size: 11pt;" lang="EN-US"><o:p></o:p></span><span lang="EN-US"></span><span lang="EN-US"></span> <span lang="EN-US"></span> <span lang="EN-US"></span><span lang="EN-US"></span> <font face="Arial" size="2"><span id="ArticleContent1_ArticleContent1_lblContent"><p style="text-indent: 21pt;"><span style="font-size: 11pt;">这应该是一个使用<span lang="EN-US">VC的一个小技巧，不过在打算做之前，在网上找了找，没有找到（可能是我填入的关键字不对，:-)），所以在这里给大家提供一个参考，希望对大家能提供方便，不用象我找的这么辛苦。<o:p></o:p></span></span></p><p style="text-indent: 21pt;"><span style="font-size: 11pt;">意图：实现多种语言在同一个工程里，如果调试成功后，即可以同时编译程序的多种语言版本。<span lang="EN-US"><o:p></o:p></span></span></p><p style="text-indent: 21pt;"><span style="font-size: 11pt;">平台：<span lang="EN-US">Win2000 Pro SP4， VC＋＋6.0，SDK<o:p></o:p></span></span></p><p style="text-indent: 21pt;"><span style="font-size: 11pt;">一般情况下，编写程序都会使用工程制作向导，生成的工程有两个编译版本，一个是<span lang="EN-US">Debug，另外一个就是Release，我的目的就是添加多种语言的编译版本，同时需要多种语言的.rc文件（Source文件），然后经过一些简单的设置，就Okay了。<o:p></o:p></span></span></p><p><span style="font-size: 11pt;" lang="EN-US"><span style="">       </span>我添加很多的图片，这样比较容易理解，也少去读文字的痛苦（用电脑看大篇大篇的文字真的很痛苦）。<o:p></o:p></span></p><p><span style="font-size: 11pt;" lang="EN-US">  下面我们开始：<o:p></o:p></span></p><p><span style="font-size: 11pt;" lang="EN-US"> 
1.
首先是以工程文件里的.rc文件为基础，制作多种语言的.rc文件，就是把有关对话框，属性页，以及一些ID文字替换为其他的语言文字，这里需要注意的
是，不同语言版本的.rc文件，包含很多相同的图标（Icon），对话框（Dialog），String
Table，在VC编译器的SourceView里都要选择相应的语种。比如：如果是English，以上说的这些都要选择English（U.S.）。</span></p><p><span style="font-size: 11pt;" lang="EN-US">  2. 添加多语言编译版本，选择Build-&gt;Configurations，点击Add，添加相应的语言编译版本，我这里添加的是English Release。随后添加多种语言版本。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-size: 11pt;">添加多种语言的编译版本</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-size: 11pt;"><br />  3. 编辑不同语言版本的Project Setting。点击菜单Project-&gt;Settings，修改相应的设置<br />设置<span lang="EN-US">Output directories： 包括Intermediate和Output files，我这里都设置为English Release</span><br />设置<span lang="EN-US">Output file name： 我这里设置为English_Release/ktrexe.exe</span></span><span style="font-family: 宋体;"><span lang="EN-US"></span><br />设置</span><span lang="EN-US">Language</span><span style="font-family: 宋体;">：</span><span style="font-family: 宋体;">英语（美国）     </span><span style="font-family: 宋体;"></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><o:p></o:p></span> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">4. </span><span style="font-family: 宋体;">添加</span><span lang="EN-US">Source Files</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"></span>  <span lang="EN-US"><o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">添加后会弹出一个对话框，不用理会它</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">此时你可以在你编译器的</span><span lang="EN-US">ResourceView</span><span style="font-family: 宋体;">里看到：</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;"></span> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">以后如果需要修改不同的语言，可以修改相应的</span><span lang="EN-US">resources</span><span style="font-family: 宋体;">文件。</span></p><span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN-US"><br style="page-break-before: always;" clear="all" /></span><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">5. </span><span style="font-family: 宋体;">点击</span><span lang="EN-US">Project-&gt;Settings</span><span style="font-family: 宋体;">，点击你所点击的</span><span lang="EN-US">.rc</span><span style="font-family: 宋体;">文件</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;"></span> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">选中</span><span lang="EN-US">Exclude file from build</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"></span> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">选择“是”，每一种</span><span lang="EN-US">.rc</span><span style="font-family: 宋体;">文件分别选取相应的语言编译版本，比如</span><span lang="EN-US">Win32 English Release</span><span style="font-family: 宋体;">，选择</span><span lang="EN-US">Winapp1_English.rc</span><span style="font-family: 宋体;">，然后在</span><span lang="EN-US">Exclude file from build</span><span style="font-family: 宋体;">打勾即可。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">6. </span><span style="font-family: 宋体;">编译：</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">选择</span><span lang="EN-US">Build-&gt;Batch Build</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"></span> </p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">选中您所要编译的语种，选中</span><span lang="EN-US">Selection only</span><span style="font-family: 宋体;">，点击</span><span lang="EN-US">Rebuild All</span><span style="font-family: 宋体;">即可。</span><br /></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">7. </span><span style="font-family: 宋体;">此时，您可以看到您的</span><span lang="EN-US">.dsp</span><span lang="EN-US">文件已经被修改。<o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">       </span></span><span style="font-family: 宋体;">我曾经在</span><span lang="EN-US">CSDN</span><span style="font-family: 宋体;">论坛上问过此问题，还有不同的解法，我把他们帖出来：</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">    </span></span><span style="font-family: 宋体;">我的操作是在</span><span lang="EN-US">VC++6.0</span><span style="font-family: 宋体;">里有一个用</span><span lang="EN-US">Win32</span><span style="font-family: 宋体;">程序向导生成的一个工程，此工程代码添加，调试，运行都已经</span><span lang="EN-US">Okay</span><span style="font-family: 宋体;">。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">    </span></span><span style="font-family: 宋体;">由于该工程是简体中文的，我想添加其他的语言版本，我就在</span><span lang="EN-US">.rc</span><span style="font-family: 宋体;">复本的基础上把简体中文的项目换成了其他的语言（比如西班牙语），然后我在</span><span lang="EN-US">Build-&gt;Configurations</span><span style="font-family: 宋体;">里添加了</span><span lang="EN-US">Spanish Release</span><span style="font-family: 宋体;">，在</span><span lang="EN-US">Project-</span><span style="font-family: 宋体;">〉</span><span lang="EN-US">Settings</span><span style="font-family: 宋体;">里设置了语言环境，输入路径等等属性。随后我就在</span><span lang="EN-US">Project-</span><span style="font-family: 宋体;">〉</span><span lang="EN-US">Add Files</span><span style="font-family: 宋体;">添加我刚才更换语言的</span><span lang="EN-US">.rc</span><span style="font-family: 宋体;">文件添加进来。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">    </span></span><span style="font-family: 宋体;">目的是用</span><span lang="EN-US">Debug</span><span style="font-family: 宋体;">调试，然后在</span><span lang="EN-US">Build-</span><span style="font-family: 宋体;">〉</span><span lang="EN-US">Batch Build</span><span style="font-family: 宋体;">选项里选择我要编译的语言种类，一次编译多种语言。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">    </span></span><span style="font-family: 宋体;">问题是</span><span lang="EN-US">VC6.0</span><span style="font-family: 宋体;">提示说“</span><span lang="EN-US">Multiple.rc
files exist in this project. Only one can be marked as included in the
build. The others will be excluded frome the build.</span><span style="font-family: 宋体;">”</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="">    </span></span><span style="font-family: 宋体;">请问，如何解决这个问题，我在网上找了两天了，在其他的</span><span lang="EN-US">Newsgroups</span><span style="font-family: 宋体;">上法帖，没有找到答案，是不是我哪里设置错了，请高手给个提示。谢谢！</span></p><div style="border-style: none none dotted; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 3pt; padding: 0cm 0cm 1pt;"><p class="MsoNormal" style="border: medium none ; margin: 0cm 0cm 0pt; padding: 0cm;"><span lang="EN-US"> <o:p></o:p></span></p></div><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">把你现在的</span><span lang="EN-US">.rc</span><span style="font-family: 宋体;">保存，然后把所有的中文换成其他语言，别存为其他</span><span lang="EN-US">other.rc</span><span style="font-family: 宋体;">。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">GetResourceInstance()</span><span style="font-family: 宋体;">得到资源句柄。换成另</span><span lang="EN-US">other.rc,(SetResourceHandle)</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">就可以搞定。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">因为所有的</span><span lang="EN-US">id</span><span style="font-family: 宋体;">没变，</span><span style="font-family: 宋体;">所有程序都能正常运行。</span></p><div style="border-style: dotted none; border-color: windowtext -moz-use-text-color; border-width: 3pt medium; padding: 1pt 0cm;"><p class="MsoNormal" style="border: medium none ; margin: 0cm 0cm 0pt; padding: 0cm;"><span style="font-family: 宋体;">最好把资源做成</span><span lang="EN-US">dll,</span><span style="font-family: 宋体;">用</span><span lang="EN-US">LoadResource</span><span style="font-family: 宋体;">切换</span></p></div><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">写成</span><span lang="EN-US">INI</span><span style="font-family: 宋体;">也是一个好办法！</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">其他论坛的回答：</span></p><div style="border-style: none none dotted; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 3pt; padding: 0cm 0cm 1pt;"><p class="MsoNormal" style="border: medium none ; margin: 0cm 0cm 0pt; padding: 0cm;"><span lang="EN-US">Several solutions:<br />1. Place all your resources into one big. rc file.<br />2. Exclude the additional rc files from the build and include them by the<br />resource includes (right mouse click on the resource file in the resource<br />editor). In this case you have to take care that bitmaps and others are only<br />included once!<br />3. Create seperate DLL's for each language and use the corresponding handle<br />to this DLL when loading resources. Read the docu to AfxSetResourceHandle<br />when you are using the MFC.</span></p></div><p class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US">1)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">      </span></span><span lang="EN-US">use the "resource includes" menu item in VC C++ 6.0 and include one<br />resource in the other (i.e. #include "file.rc")  Make sure that there are no<br />conflicts and each resource is properly marked with the correct language.<br />Mark the RC file as excluded from the build.  It will get built anyway since<br />it was included in the main RC.</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US">2)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">      </span></span><span lang="EN-US">have separate DLL (i.e. a separate sub-project) for each RC file (the<br />satellite DLL approach to localization)</span></p><div style="border-style: dotted none; border-color: windowtext -moz-use-text-color; border-width: 3pt medium; padding: 1pt 0cm;"><p class="MsoNormal" style="border: medium none ; margin: 0cm 0cm 0pt; padding: 0cm;"><span lang="EN-US">If you are unhappy with having separate builds for each language then<br />you'll have to combine the .rc files with (or without if they doesn't use<br />same identifiers) the proper LANGUAGE ID #ifdef's. If you don't know<br />about these, use the Resource editor built into the Environment to create<br />a new .rc with element variants in several languages. Then open the file<br />and analyse it.</span></p></div><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US">In VS.NET 2003 click on Build&gt;Configuration Manager<br />You will find your project. Now it is possible to select New in the combo<br />"Active Solution Configuration" you can add new settings to the current ones<br />Debug/Release.<br />In VS6 click on Build-&gt;Configurations. You will find your project displayed<br />as a tree. Click on Add to add new configurations.<br />In both caes you will be asked what base configuratin should be copied.<br /><br />Now you can create different Release modes like German/English/Bavarian and<br />so on...<br />For each configuration you can define diffrent rc files to be excluded from<br />the build. Also you can define different output directories.<br /><br />The disadvantage is that you always have a complete binary for a language<br />and you can not switch the language on user request!</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"> <o:p></o:p></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 宋体;">如果有问题，请和我联系：</span><span lang="EN-US">danielxu22@cellink.com.cn</span></p></span></font><img src ="http://www.cppblog.com/erran/aggbug/34149.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 21:24 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34149.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转：改变VC++应用程序窗口的标题</title><link>http://www.cppblog.com/erran/archive/2007/10/13/34140.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 12:02:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34140.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34140.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34140.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34140.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34140.html</trackback:ping><description><![CDATA[
		<div class="Section1">
				<p class="MsoNormal" style="line-height: 13.9pt; text-align: center;" align="center">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 16pt;">改变<span lang="EN">VC++应用程序窗口的标题<o:p></o:p></span></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="line-height: 13.9pt; text-align: center;" align="center">
						<font face="Arial" size="2">上海卢湾区业余大学<span lang="EN"><span style="">      </span>邵祖铭</span></font>
				</p>
				<p class="MsoNormal" style="margin-top: 15.1pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">摘<span lang="EN"><span style="">  </span>要:讨论基于MFC类库的Windows应用程序设计中,应用程序各种标题的改变方法。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">关键词<span lang="EN">:MFC Windows编程标题Visual C++<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">0 引言<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">有一个演示<span lang="EN">VC++中的消息处理的单文档应用程序。该程序开始运行的情况如下:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">窗口中的初始文档标题竞显示为<span lang="EN">Untitled,实在不尽人意。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">有些时候<span lang="EN">,
确实需要改变自编Windows应用程序窗口的标题。比如,想编一个标题名为"Communication
soft的软件。虽然在Windows95或Windows NT下,Visual C++(以下简称VC)可以生成以"Communication
soft为名的工程,但该工程下的C++类的名称也要带上这么多的字符,给编程带来不便。可以采用的方法是生成以"CS为名的工程,再把程序的标题改成
"Communication Soft。再比如,在多文档应用程序中,希望每个子窗口的标题并不是"主窗口标题t、"主窗口标题2</span></span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;">……这种类型<span lang="EN">,而是象"COM1速率"、"LPT并行口"……,即子窗口标题与主窗口标题无关。这时都需要改变各种窗口标题。下面介绍一下改变窗口标题所用的方法,所用的开发平台是usual C++5.0。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">1 单又挡接口(SDI)典型窗口标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">首先<span lang="EN">,来看看Windows SD!类型窗口标题栏的结构形式。用VC的AppWizard创建一个名为"Exam9的单文档类型的工程。开始运行时,程序主窗口标题形式如下:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.9pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">Untitled-Exam9<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">其中<span lang="EN">"Untitied"为文档标题,"Exam9"为主窗口标题。当用"File-Open</span></span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;">打开<span lang="EN">"wd1.exm"文裆以后,文档标题变为"wd1.exm"。</span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span lang="EN">所以程序主窗口标题栏的一般形式为:<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">文裆标题<span lang="EN">----主窗口标题<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">1.1 又档标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">既然文档标题是由工程中相应的文档类所控制的<span lang="EN">,了解这一点,就可在相应的文档类中,利用SetTitle()函数来改变文档标题。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">例：改变<span lang="EN">CExam9Doc::onNewDocument()函数为:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">BOOL CExam9Doc::OnNewDocument()<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">{<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">if(!CDocument::OnNewDocument())<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 42pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return FALSE-<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">SetTitle("文档标题");<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return TRUE;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">}<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">运行程序<span lang="EN">,则每次选择选单中的"文件"的"新建"选项时,标题就变成"文档标题-Exam9</span></span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;" lang="EN">
										<o:p>
										</o:p>
								</span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt;">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">1.2 主窗口标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">主窗口的标题默认是工程的文件名<span lang="EN">,正如前面Appvvazied生成的Exam9工程执行后,标题栏的形式总为"文档标题-Exam9。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">改变主窗口的标题方法有两种<span lang="EN">:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">第一种方法<span lang="EN">:利用ResourceView打开工程的资源,修改String Table中的<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">IDR_MAINFRAME的值。将原来的"Exam9\n\nExam9\nEXMFile(*.exm)\n.exm\nExam9.Document\nExam9 Document"改为"标题改变示例<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">\n\nExam9\nEXM File(*.exm)\n.exm\nExam9.Document\nExam9 Document"。这样改变后,主窗口标题就变为"-标题改变示例"。第二种方法:具体改变方法如下:<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">改变<span lang="EN"> CMainFrame的成员函数PreCreateWindowO为:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">BOOL CMainFrame::PreCreateWindow(CREATESTRUCT&amp;cs)<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">{<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">m_strTitle="上海市卢湾区业余大学</span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;" lang="EN">;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return CFrameWnd::PreCreateWindow(cs);<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">}<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">这样改变后<span lang="EN">,主窗口标题的形式就为"-上海市卢湾区业余大学"。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 0.7pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">M_strTile是CFrameWnd的保护成员(要得到m_strTile更详细的信息,请打开\msdev\mfc\include\afxwin.h文件)。CMainFrame则是CFrameWnd类的派生类。<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">在这两种改变方法中<span lang="EN">,第二种方法优先级高。也就是说,改变了m_strTitle的值后,IDR_MAlNFRAME的值就不起作用。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 3.35pt;">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">2 对多文挡接口(MDI)类型窗口标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">在<span lang="EN">MDI类型窗口中,主窗口标题和文档标题的次序,和SDl类型窗口中次序是不同的。结合具体例子说明,用VC的AppWizard创建一个名为"MDITitle"的多文挡类型的工程。创建完工程后,编译运行该工程,主窗口标题形式如下:"主窗口标题-文档标题"。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">2.l 文挡标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">MDI类型窗口的文档标题也是由相应的文档类控制的。改变方法同SDI类型窗口类似,要改变标题,只要在相应的文档类中利用SetTitle()函数来改变文档标题。<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">2.2 主窗口标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">MDI类型主窗口标题的改变方法同SDI类型窗口类似。改变主窗口标题也有两种方法,通过改变IDR_MAINFRAME或m_strTitle的值就可实现改变主窗口标题的目的。同样,改变了m_strTitle值后,IDR_MAINFRAME的值就不起作用。<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<b>
										<span style="font-size: 10.5pt;" lang="EN">2.3 子窗口标题的改变<o:p></o:p></span>
								</b>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">在默认情况下<span lang="EN">,MFC自动将子窗口标题设为该子窗口所打开的文档标题。但实际上,子窗口标题与该子窗口标题所打开的文档标题可以不一样。可做如下改动:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">利用<span lang="EN">ResourceView打开资源,修改String Table中的IDR_MAINFRAME的值为"上海市卢湾区业余大学",使得主窗口标题变成"上海市卢湾区业余大学"。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">并将<span lang="EN">BOOL CMDlTitleDoc::OnNewDocument()函数改为:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">BOOL CMDlTitleDoc::OnNewDocument()<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">{<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">if(!CDocument::OnNewDocument())<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 42pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return FALSE;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">static int count=0;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.9pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">char message[10];<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.2pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">wsprintf(message,"%s%d","文档",count);<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.2pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">SetTitle(message);<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 1.2pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">count++;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return TRUE;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">}<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">通过以上修改<span lang="EN">,主窗口标题栏被设置为:文档标题为"上海市卢湾区业余大学-文挡0"、"上海市卢湾区业余大学-文档1</span></span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;">……<b><span lang="EN"><o:p></o:p></span></b></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 4.55pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">一下针对子窗口标题的修改作如下改动<span lang="EN">:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">将<span lang="EN">CChildFrame::PrecreateWindow()函数改为:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">BOOL CChiidFrame::PrecreateWindow(CREATESTRUCT&amp;cs)<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">cs.style &amp;=~(LONG)FWS_ADDTOTlTLE;<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">return CMDIChildWnd::PrecreateWindow(cs);<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">}<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.15pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">要改变窗口类型<span lang="EN">, 这步工作必须做。常量问FWS_ADDTOTITLE是在文件\msdev\mfc\include\afxwin.h中定义。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.6pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">在<span lang="EN"> CMDlTitleView类中增加OnlnitialUpdate()函数:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.6pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">void CMDlTitleView::OnlnitiaiUpdate()<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.6pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">{<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.6pt; text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">CView::OninitialUpdate();<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="text-indent: 21pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">Getparent()-〉SetWindowText(GetDocument()-)GetTitle()+</span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;" lang="EN">-上海卢湾区业余大学</span>
								<span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN">”</span>
								<span style="font-size: 10.5pt;" lang="EN">);<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">}<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">这样<span lang="EN">,子窗口的标题栏的形式就为"文档名-上海卢湾区业余大学"。<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 14.6pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;">参考资料<span lang="EN">:<o:p></o:p></span></span>
						</font>
				</p>
				<p class="MsoNormal" style="margin-top: 2.4pt;">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">[1]Michaei Morrison:Sams Tech Yourself MFC in 24Hours<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">[2]David krugiinski:Programming Microsoft Visual C++,FiHh Edition<o:p></o:p></span>
						</font>
				</p>
				<p class="MsoNormal" style="">
						<font face="Arial" size="2">
								<span style="font-size: 10.5pt;" lang="EN">[3]Kate Gregory:Special Edition Using Visual C++5<o:p></o:p></span>
						</font>
				</p>
		</div>
<img src ="http://www.cppblog.com/erran/aggbug/34140.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 20:02 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34140.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CToolTipCtrl使用</title><link>http://www.cppblog.com/erran/archive/2007/10/13/34139.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 11:59:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34139.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34139.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34139.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34139.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34139.html</trackback:ping><description><![CDATA[
		<p align="left">
				<font size="3">ToolTip是Win32中一个通用控件，MFC中为其生成了一个类CToolTipCtrl，总的说来其使用方法是较简单的，下面讲一下它的一般用法和高级用法。</font>
		</p>
		<strong>
				<font size="3">一般用法步骤：</font>
		</strong>
		<br />
		<ol>
				<li>
						<p align="left">
								<font size="3">添加CToolTipCtrl成员变量 m_tt。</font>
						</p>
				</li>
				<li>
						<p align="left">
								<font size="3">在父窗口中调用EnableToolTips(TRUE);</font>
								<br />
						</p>
				</li>
				<li>
						<font size="3">在窗口的OnCreate（或者其他适当的位置）中向ToolTip中添加需要显示Tip的子窗口，并同时指定相应的显示字串CToolTipCtrl::AddTool(pWnd,"string to display")。</font>
						<br />
				</li>
				<li>
						<p align="left">
								<font size="3">重载父窗口的 BOOL PreTranslateMessage(MSG* pMsg) ，在函数中调用 m_tt.RelayEvent(pMsg)。</font>
						</p>
				</li>
		</ol>
		<font size="3">下面假设在窗口CWndYour中使用CToolTipCtrl</font>
		<pre>
				<font size="3">在类定义中添加变量说明：<br /><br />class CWndYour:xxx<br />{<br />	CToolTipCtrl m_tt;<br />}<br /><br />在OnCreate中添加需要显示Tip的子窗口<br />CWndYour::OnCreate(....)<br />{<br />	EnableToolTips(TRUE);<br />	m_tt.Create(this);<br />	m_tt.Activate(TRUE);<br />	CWnd* pW=GetDlgItem(IDC_CHECK1);//得到窗口指针<br />	m_tooltip.AddTool(pW,"Check1");//添加<br />........<br /><br />}<br /><br />在BOOL PreTranslateMessage(MSG* pMsg)中添加代码<br />BOOL CWndYour::PreTranslateMessage(MSG* pMsg)<br />{<br />	{<br />		m_tt.RelayEvent(pMsg);<br />	}<br />	return CParentClass::PreTranslateMessage(pMsg);<br />}<br /></font>
		</pre>
		<p align="left">
				<font size="3">这样当鼠标移动到相应的子窗口上时会显示出相应的ToolTip。</font>
		</p>
		<strong>
				<font size="3">动态改变ToolTip的显示内容的方法及步骤：</font>
		</strong>
		<br />
		<ol>
				<br />
				<li>
						<font size="3">上面所讲的1、2、4步骤。</font>
						<br />
				</li>
				<li>
						<font size="3">在增加ToolTip时不指定显示的字串，而是使用LPSTR_TEXTCALLBACK。</font>
						<br />
				</li>
				<li>
						<font size="3">在窗口中增加消息映射 ON_NOTIFY_EX( TTN_NEEDTEXT, 0, SetTipText )。</font>
				</li>
				<li>
						<font size="3">
						</font>
						<p align="left">
								<font size="3">在窗口中增加一个函数用于动态提供显示内容，其原型为 BOOL SetTipText( UINT id, NMHDR * pTTTStruct, LRESULT * pResult )，下面的代码可以根据传入的参数判定应该显示的内容。</font>
						</p>
				</li>
		</ol>
		<pre>
				<font size="3">BOOL CWndYour::SetTipText( UINT id, NMHDR * pTTTStruct, LRESULT * pResult )<br />{<br />	TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pTTTStruct;    <br />	UINT nID =pTTTStruct-&gt;idFrom; //得到相应窗口ID，有可能是HWND<br />	if (pTTT-&gt;uFlags &amp; TTF_IDISHWND)    //表明nID是否为HWND<br />	{<br />	        nID = ::GetDlgCtrlID((HWND)nID);//从HWND得到ID值，当然你也可以通过HWND值来判断<br />		switch(nID)<br />		case(IDC_YOUR_CONTROL1)        <br />			strcpy(pTTT-&gt;lpszText,your_string1);//设置<br />			return TRUE;<br />		break;<br />		case(IDC_YOUR_CONTROL2)<br />			//设置相应的显示字串<br />			return TRUE;<br />		break;<br />	}<br />	return(FALSE);<br />}</font>
		</pre>
<img src ="http://www.cppblog.com/erran/aggbug/34139.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 19:59 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34139.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC中取代状态栏默认“就绪”提示</title><link>http://www.cppblog.com/erran/archive/2007/10/13/34138.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 11:55:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34138.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34138.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34138.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34138.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34138.html</trackback:ping><description><![CDATA[
		<div class="cnt">
				<p>
						<font face="Arial" size="2">在MFC程序中如果使用默认的状态栏的话，其第一栏在空闲时显示的是“就绪”，如果用户点击菜单，还会用于显示菜单栏的提示文本，如“建立新文档”等。有时候我们不希望程序在状态栏中显示这些东西，那该怎么办呢？</font>
				</p>
				<p>
						<font face="Arial" size="2">在MFC中，是用主框架类中的CStatusBar对象m_wndStatusBar来管理状态栏的。CStatusBar中有一个SetPaneText的函数可用于设置状态栏中的文字。我们在CMainFrame类中的OnCreate函数中添加</font>
				</p>
				<p>
						<font face="Arial" size="2">m_wndStatusBar.SetPaneText(0, "Hello");</font>
				</p>
				<p>
						<font face="Arial" size="2">则程序启动后，状态栏上显示的文字为“Hello”。但是当我们点击菜单后，会发现这段文字会消失，被替换成菜单的提示文本；若菜单操作结束，则又显示成“就绪”了。那该如何禁止MFC自动修改状态栏文本呢？</font>
				</p>
				<p>
						<font face="Arial" size="2">我们再看看主框架类的源程序。当中有这么一段</font>
				</p>
				<p>
						<font face="Arial" size="2">static UINT indicators[] =<br />
{<br />
ID_SEPARATOR,<br />
ID_INDICATOR_CAPS,<br />
ID_INDICATOR_NUM,<br />
ID_INDICATOR_SCRL,<br />
};</font>
				</p>
				<p>
						<font face="Arial" size="2">而在OnCreate中有这么一段</font>
				</p>
				<p>
						<font face="Arial" size="2">m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))</font>
				</p>
				<p>
						<font face="Arial" size="2">这一句的作用是设置状态栏各部分的ID，默认的ID由indicators数组指定。由于MFC中把状态栏的第一栏设置为ID_SEPARATOR
了，这是一个MFC默认的ID，所以它有一系列默认的操作，如显示“就绪”二字。我们想禁止MFC自动操作状态栏就必须修改indicators数组。</font>
				</p>
				<p>
						<font face="Arial" size="2">我们打开Resource View，修改String Table，找到那堆ID_INDICATOR开头的，在后面新加一个ID_INDICATOR_1。然后修改CMainFrame中indicators的声明</font>
				</p>
				<p>
						<font face="Arial" size="2">static UINT indicators[] =<br />
{<br />
ID_INDICATOR_1,<br />
ID_INDICATOR_CAPS,<br />
ID_INDICATOR_NUM,<br />
ID_INDICATOR_SCRL,<br />
};</font>
				</p>
				<p>
						<font face="Arial" size="2">然后编译运行程序。我们会发现，MFC不会再自动修改状态栏的文本了，可是前面添加的一句<br />
m_wndStatusBar.SetPaneText(0, "Hello");<br />
也不起作用了。这是为什么呢？</font>
				</p>
				<p>
						<font face="Arial" size="2">
								<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_status_bars.3a_.updating_the_text_of_a_status.2d.bar_pane.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_status_bars.3a_.updating_the_text_of_a_status.2d.bar_pane.asp</a>
								<br />
MSDN上有一篇介绍如果修改状态栏文本的文章。当中有一句</font>
				</p>
				<p>
						<font face="Arial" size="2">Note   The SetText approach is recommended. It is possible to
perform this task at a slightly lower level by calling the CStatusBar
member function SetPaneText. Even so, you still need an update handler.
Without such a handler for the pane, MFC automatically disables the
pane, erasing its content.</font>
				</p>
				<p>
						<font face="Arial" size="2">意思大概是如果我们不为状态栏添加UPDATE的处理函数，MFC会自动禁止状态栏的该栏(pane)。按照MSDN的说法，我们需要增加UPDATE的处理函数。在MainFrm.h中添加</font>
				</p>
				<p>
						<font face="Arial" size="2">afx_msg void OnUpdate1(CCmdUI *pCmdUI);</font>
				</p>
				<p>
						<font face="Arial" size="2">在MainFrm.cpp中添加</font>
				</p>
				<p>
						<font face="Arial" size="2">ON_UPDATE_COMMAND_UI(ID_INDICATOR_1, OnUpdate1)</font>
				</p>
				<p>
						<font face="Arial" size="2">void CMainFrame::OnUpdate1(CCmdUI *pCmdUI)<br />
{<br />
 pCmdUI-&gt;Enable();<br />
}</font>
				</p>
				<p>
						<font face="Arial" size="2">这样我们就可以往状态栏的第一栏写文字，而避开MFC对其的自动修改了。</font>
				</p>
		</div>
<img src ="http://www.cppblog.com/erran/aggbug/34138.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 19:55 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34138.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>定制Wnd（对话框）窗口类名</title><link>http://www.cppblog.com/erran/archive/2007/10/13/34126.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 09:43:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34126.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34126.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34126.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34126.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34126.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">定制Wnd（对话框）窗口类名<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>一 主窗口为CWnd的派生类</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BOOL CMainWnd::PreCreateWindow(CREATESTRUCT&amp; cs) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WNDCLASS wndcls;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ZeroMemory( &amp;wndcls, sizeof(WNDCLASS) );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.style&nbsp;&nbsp; = CS_DBLCLKS;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.lpfnWndProc&nbsp; = AfxWndProc;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.hInstance&nbsp; = AfxGetInstanceHandle();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.hIcon&nbsp;&nbsp; = theApp.LoadIcon( IDR_MAINFRAME );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.hCursor&nbsp;&nbsp; = theApp.LoadStandardCursor( IDC_ARROW );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.hbrBackground = NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.lpszMenuName&nbsp; = NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.lpszClassName = _T("MyMainWnd");<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AfxRegisterClass( &amp;wndcls );<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cs.lpszClass = wndcls.lpszClassName;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return CMDIFrameWnd::PreCreateWindow( cs );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">二 主窗口为CDialog的派生类</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第一步 在BOOL CMyApp::InitInstance()中 声明Dialog对象之前添加</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WNDCLASS wndcls;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::GetClassInfo( AfxGetInstanceHandle(), "#32770", &amp;wndcls );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wndcls.lpszClassName = _T("MyDialog");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AfxRegisterClass( &amp;wndcls );</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第二步&nbsp; 有两种方法</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a&nbsp; 直接修改&#215;&#215;.rc文件</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IDD_MY_DIALOG DIALOGEX 0, 0, 319, 152<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STYLE DS_SETFONT | DS_MODALFRAME |&nbsp; &#8230;&#8230;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXSTYLE WS_EX_APPWINDOW<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAPTION "Lottery2"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLASS "MyDialog"//添加此行即可<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT 9, "MS Shell Dlg", 0, 0, 0x1</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b&nbsp; 修改属性<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在IDE中修改&#215;&#215;.rc属性 vc6 取消Enable MFC features</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .net&nbsp; Mfc mode = FALSE</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在Dialog属性中的class name 项中 输入 MyDialog即可<br><br><br>参考：<u><font color=#800080>VC++中定制个性化的对话框窗口类</font></u>&nbsp;<a href="http://blog.csdn.net/chinawash/archive/2006/06/25/832338.aspx">http://blog.csdn.net/chinawash/archive/2006/06/25/832338.aspx</a><br></p>
<img src ="http://www.cppblog.com/erran/aggbug/34126.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 17:43 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34126.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>__declspec(dllexport)与.def文件</title><link>http://www.cppblog.com/erran/archive/2007/10/13/34120.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 13 Oct 2007 09:01:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2007/10/13/34120.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/34120.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2007/10/13/34120.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/34120.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/34120.html</trackback:ping><description><![CDATA[<font size=2>
<p><br><strong>__declspec(dllexport)与.def文件</strong><br><br><br>在VC++中，如果生成DLL可以不使用.def文件。只需要在VC++的函数定义前要加__declspec(dllexport)修饰就可以了。但是使用__declspec(dllexport)和使用.def文件是有区别的。如果DLL是提供给VC++用户使用的，只需要把编译DLL时产生的.lib提供给用户，它可以很轻松地调用你的DLL。但是如果DLL是供VB、PB、Delphi用户使用的，那么会产生一个小麻烦。因为VC++对于__declspec(dllexport)声明的函数会进行名称转换，如下面的函数： <br>&nbsp;&nbsp;&nbsp;&nbsp;__declspec(dllexport) int __stdcall IsWinNT() <br>&nbsp;&nbsp;&nbsp;&nbsp;会转换为IsWinNT@0，这样你在VB中必须这样声明： <br>&nbsp;&nbsp;&nbsp;&nbsp;Declare Function IsWinNT Lib "my.dll" Alias "IsWinNT@0" () As Long <br>&nbsp;&nbsp;&nbsp;&nbsp;@的后面的数由于参数类型不同而可能不同。这显然不太方便。所以如果要想避免这种转换，就要使用.def文件方式。 <br>&nbsp;&nbsp;&nbsp;&nbsp;EXPORTS后面的数可以不给，系统会自动分配一个数。对于VB、PB、Delphi用户，通常使用按名称进行调用的方式，这个数关系不大，但是对于使用.lib链接的VC程序来说，不是按名称进行调用，而是按照这个数进行调用的，所以最好给出。如：<br>EXPORTS&nbsp;<br>test @1&nbsp;<br><br>&nbsp;&nbsp;vc的dll，delphi调用的方法：<br><br>////K9RtExpr.h<br>extern "C" __DECDLL <br>unsigned int _stdcall K9RtSysInterrupt(int nInterruptTag);<br><br>extern "C" __DECDLL <br>unsigned int _stdcall K9RtSysExprm(unsigned int nModuleTag, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float fTimeout,&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void * pTestPar,&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void * pResultPar&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br><br>// K9RtExpr.cpp<br>#include "K9RtExpr.h"<br>#include "RtCtrl.h"<br>extern "C" __DECDLL <br>unsigned int _stdcall K9RtSysInterrupt(int nInterruptTag)<br>{<br>&nbsp;return CRelayTestControl::Instance()-&gt;InterruptTest(nInterruptTag);<br>}<br>extern "C" __DECDLL <br>unsigned int _stdcall K9RtSysExprm(unsigned int nModuleTag, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float fTimeout,&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void * pTestPar,&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void * pResultPar&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>{<br>&nbsp;return CRelayTestControl::Instance()-&gt;RelayTest(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nModuleTag, fTimeout, pTestPar, pResultPar);<br>}<br><br>///K9RtExpr.def<br>LIBRARY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "K9RtExpr"<br>DESCRIPTION&nbsp; K9RtExpr Windows Dynamic Link Library'</p>
<p>EXPORTS<br>K9RtSysInterrupt<br>K9RtSysExprm<br>&nbsp;&nbsp;&nbsp; ; Explicit exports can go here<br><br><br>//delphi&nbsp;&nbsp; 调用文件 <br>unit InterfaceFunc;</p>
<p>interface</p>
<p>uses<br>&nbsp;&nbsp; UnitData,Types;<br>&nbsp;&nbsp; <br>function K9RtSysExprm(nModuleTag:integer&nbsp; ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uTimeout:integer;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;pTestPar:Pointer;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;pResultPar:Pointer) : Integer; stdcall;</p>
<p>function K9RtSysInterrupt(nInterruptType:Integer) : Integer; stdcall;</p>
<p>implementation<br>const DLLPATH&nbsp; = 'RtBsExpr.dll';<br>function K9RtSysExprm; external DLLPATH&nbsp; name&nbsp; 'ExperimentRelayTest';<br>function K9RtSysInterrupt; external DLLPATH&nbsp; name 'InterruptRelayTest';<br><br>end.</p>
</font>
<img src ="http://www.cppblog.com/erran/aggbug/34120.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2007-10-13 17:01 <a href="http://www.cppblog.com/erran/archive/2007/10/13/34120.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MFC HANDLE集合</title><link>http://www.cppblog.com/erran/archive/2006/12/26/16879.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Tue, 26 Dec 2006 11:12:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2006/12/26/16879.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/16879.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2006/12/26/16879.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/16879.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/16879.html</trackback:ping><description><![CDATA[<font face="Courier New" size=2>HACCEL&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Handle to an accelerator table. <br>HANDLE&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; Handle to an object. <br>HBITMAP&nbsp; &nbsp;&nbsp;&nbsp; Handle to a bitmap.&nbsp; <br>HBRUSH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a brush. <br>HCONV&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a dynamic data exchange (DDE) conversation. <br>HCONVLIST &nbsp;&nbsp; Handle to a DDE conversation list. <br>HCURSOR &nbsp;&nbsp;&nbsp;&nbsp; Handle to a cursor. <br>HDC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a device context (DC). <br>HDDEDATA &nbsp;&nbsp;&nbsp; Handle to DDE data. <br>HDESK &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a desktop. <br>HDROP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to an internal drop structure. <br>HDWP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a deferred window position structure. <br>HENHMETAFILE&nbsp;Handle to an enhanced metafile. <br>HFILE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a file opened by OpenFile, not CreateFile. <br>HFONT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle to a font. <br>HGDIOBJ &nbsp;&nbsp;&nbsp;&nbsp; Handle to a GDI object. <br>HGLOBAL &nbsp;&nbsp;&nbsp;&nbsp; Handle to a global memory block. <br>HHOOK &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a hook. <br>HICON &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to an icon. <br>HIMAGELIST &nbsp; Handle to an image list. <br>HIMC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to input context. <br>HINSTANCE &nbsp;&nbsp; Handle to an instance. <br>HKEY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a registry key. <br>HKL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Input locale identifier. <br>HLOCAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle to a local memory block. <br>HMENU &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a menu. <br>HMETAFILE &nbsp;&nbsp; Handle to a metafile. <br>HMODULE &nbsp;&nbsp;&nbsp;&nbsp; Handle to a module. The value is the base address of the module. <br>HMONITOR &nbsp;&nbsp;&nbsp; Handle to a display monitor. <br>HPALETTE &nbsp;&nbsp;&nbsp; Handle to a palette. <br>HPEN &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a pen.&nbsp; <br>HRGN &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a region. <br>HRSRC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a resource. <br>HSZ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a DDE string. <br>HWINSTA &nbsp;&nbsp;&nbsp;&nbsp; Handle to a window station. <br>HWND &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle to a window. <br></font>
<img src ="http://www.cppblog.com/erran/aggbug/16879.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2006-12-26 19:12 <a href="http://www.cppblog.com/erran/archive/2006/12/26/16879.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>双缓冲绘图</title><link>http://www.cppblog.com/erran/archive/2006/11/25/15650.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Sat, 25 Nov 2006 01:23:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2006/11/25/15650.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/15650.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2006/11/25/15650.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/15650.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/15650.html</trackback:ping><description><![CDATA[<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>VC</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">双缓冲绘图</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>BOOL CGraphDlg::OnDraw(CDC* pDC)</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>{</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>CRect rc;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GetClientRect(&amp;rc);<span style="mso-tab-count: 1">&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>CDC<span style="mso-spacerun: yes">&nbsp; </span>MemDC; </span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>CBitmap<span style="mso-spacerun: yes">&nbsp; </span>MemBitmap;<span style="mso-tab-count: 1">&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemDC.CreateCompatibleDC(NULL);<span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemBitmap.CreateCompatibleBitmap(pDC, rc.Size().cx,rc.Size().cy);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>CBitmap *pOldBit=MemDC.SelectObject(&amp;MemBitmap);<span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemDC.BitBlt(0,0,rc.width, rc.height, pDC,0,0,SRCCOPY);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>m_pGraph-&gt;SetGraphDC(&amp;MemDC);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>m_pGraph-&gt;DoGraphShowEvent();<span style="mso-tab-count: 1">&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>pDC-&gt;BitBlt(0,0, rc.Size().cx,rc.Size().cy,&amp;MemDC,0,0,SRCCOPY);<span style="mso-tab-count: 1">&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemDC.SelectObject(pOldBit);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemBitmap.DeleteObject();</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MemDC.DeleteDC();</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>}</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>Delphi </span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">双缓冲绘图：</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>procedure TBkCoordi.Draw(Canvas : TCanvas);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>var</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp : TBitmap;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_width, _height : integer;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_top, _left : integer;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>begin</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_width := Round(m_width);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_height := Round(m_height);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_left := Round(m_topleft.x);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_top := Round(m_topleft.y);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp := Tbitmap.Create;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp.Handle := CreateCompatibleDC(Canvas.Handle);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp.Width :=<span style="mso-spacerun: yes">&nbsp; </span>_width;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp.Height :=<span style="mso-spacerun: yes">&nbsp; </span>_height;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>BitBlt(_bmp.Canvas.Handle,0,0,_width,_height, Canvas.Handle,_left,_top,SRCCOPY);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;</span>if m_showcross then m_cross.Draw(_bmp.Canvas);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>if @OnDrawing &lt;&gt; nil then OnDrawing(_bmp.Canvas);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>BitBlt(Canvas.Handle,_left,_top,_width,_height, _bmp.Canvas.Handle,0,0,SRCCOPY);</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>&nbsp;<o:p></o:p></span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>_bmp.Free;</span> </p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US>end;</span> </p>
<img src ="http://www.cppblog.com/erran/aggbug/15650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2006-11-25 09:23 <a href="http://www.cppblog.com/erran/archive/2006/11/25/15650.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>郁闷的error link 2019</title><link>http://www.cppblog.com/erran/archive/2006/06/02/8063.html</link><dc:creator>erran</dc:creator><author>erran</author><pubDate>Thu, 01 Jun 2006 17:24:00 GMT</pubDate><guid>http://www.cppblog.com/erran/archive/2006/06/02/8063.html</guid><wfw:comment>http://www.cppblog.com/erran/comments/8063.html</wfw:comment><comments>http://www.cppblog.com/erran/archive/2006/06/02/8063.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/erran/comments/commentRss/8063.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/erran/services/trackbacks/8063.html</trackback:ping><description><![CDATA[<p dir=ltr style="MARGIN-RIGHT: 0px"><font size=2>2006-06-01:&nbsp;&nbsp;郁闷的error link 2019<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 找了一两个小时的2019, 就是不知道是什么原因error了, 我都快要疯了, 所有的lib都没问题, 就是link error, 想不到是什么原因, 烦的我差点扒着睡着了, ^_^,&nbsp; 最后我注释掉了lib中所有的链接失败的函数,&nbsp;&nbsp;没问题了,&nbsp; 鼠标在那些函数上点着点着的, 突然发现, 这些函数都是inline的, 晕, 原来, 我可爱的同事忘了 #include&nbsp;"*.inl" 了,&nbsp; 晕死, 这样的错误叫我怎么找啊,&nbsp; 我简直........ 还好用了这么长时间找到了. 终于万事大吉了.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 晚上给个朋友演示了一下重载赋值操作符和拷贝构造函数的区别,&nbsp; CBase base = 2;&nbsp;(=)执行的是拷贝构造函数CBase(const int&amp; n&nbsp;)&nbsp;;&nbsp;而 CBase base; base = 2; (=)执行的是operator =(const int&amp; n&nbsp;).<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 看到一个刚毕业的大本来我们公司面试,&nbsp; 是让他用C/C++随便写个排序算法, 他居然华了一个多小时还没写出来, 才写了几行代码, 唉....不知道怎么说好..... 几乎所有的大学都有计算机系, 而且都还不小, 可是哪教学, 哪老师, 唉....&nbsp;想到了我毕业的时候, 会了delphi, 还培训过dotnet,&nbsp;&nbsp; 也学过VC, (想当初自学VC, 哪滋味真是, 最后毕业了也只会在界面上拖来拖去的, 哈哈).工作了才明白了当时的错. 其实那些都是工具工具而已, 而关键的应该学好的反而没花多少时间去学, 反而没学好, 所以还在工作的时候回头来补C++一些基本的东西, 感觉真丢人. 没想到最后会做C++开发. 不过还是瞒好的,&nbsp; 很喜欢C++.&nbsp;</font> </p>
<img src ="http://www.cppblog.com/erran/aggbug/8063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/erran/" target="_blank">erran</a> 2006-06-02 01:24 <a href="http://www.cppblog.com/erran/archive/2006/06/02/8063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>