大约有 45,000 项符合查询结果(耗时:0.0353秒) [XML]
MFC对话框中处理Enter或Esc按键事件方法 - C/C++ - 清泛网 - 专注C/C++及内核技术
...e(MSG* pMsg);
//.cpp
BOOL CxxxDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
switch(pMsg->wParam)
{
case VK_ESCAPE: //Esc按键事件
return TRUE;
case VK_RETURN: //Enter按键事件
...
warning C4172: returning address of local variable or temporary - C/C+...
... string,set<int> >::const_iterator it = m_mapWordLine.find(word);
if(it != m_mapWordLine.end())
return it->second;
else
return set<int>();//emptyset
}
解决方法:愿意是返回set对象的const引用以减轻复制set对象的负担,但是这里返...
CFileDialog用法及参数解释 - C/C++ - 清泛网 - 专注C/C++及内核技术
...EREADONLY|OFN_OVERWRITEPROMPT,"(*.avi;*.mp4;*.wmv)|*.avi;*.mp4;*.wmv||");
if(dlg.DoModal() == IDOK)
{
m_video = dlg.GetPathName();
}
CString CFileDialog::GetPathName( ) 得到完整的文件名,包括目录名和扩展名如:c:\ test\test1.txt
CString CFileDialog::GetFileName( ) 得...
[完整实例源码]C&C++修改文件只读属性 - C/C++ - 清泛网 - 专注C/C++及内核技术
...eAttributes(strPath);
//空32,只读33,隐藏34,只读隐藏35
if (dwAttrs & FILE_ATTRIBUTE_READONLY && (dwAttrs < 34))
{
//去掉文件只读属性
dwAttrs &= 0x3E;
SetFileAttributes(strPath, dwAttrs);
printf("File '%s' readonly attr is removed.\n", strPath);
}
else...
MFC 获取并移动其他应用程序窗口的方法 - C/C++ - 清泛网 - 专注C/C++及内核技术
...口的方法:
//等待启动完毕
HWND hMain = NULL;
while(1)
{
if (hMain = ::FindWindow(NULL, "窗口标题"))
{
CRect rect, rectDlg;
pMainFrame->GetWindowRect(&rect);
::GetWindowRect(hMain, rectDlg);
::SetWindowPos(hMain, NULL, rect.right-10, rect.top, rectDlg.Width(), r...
Error: must call SetScrollSizes() or SetScaleToFitSize()问题的解决 - C...
...nPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
ASSERT_VALID(pDC);
#ifdef _DEBUG
if (m_nMapMode == MM_NONE)
{
TRACE(traceAppMsg, 0, "Error: must call SetScrollSizes() or SetScaleToFitSize()");
TRACE(traceAppMsg, 0, "\tbefore painting scroll view.\n");
--->...
MFC Static透明背景色的实现、Static控件自绘、Static字体修改 - C/C++ - ...
...起作用的在这句
HBRUSH hb = (HBRUSH)GetStockObject(NULL_BRUSH);
if(CTLCOLOR_STATIC == nCtlColor)
{
pDC->SetTextColor(m_crText);
pDC->SetBkColor(m_crBk);
hb = m_hbkbr;
}
return hb;
}
这种方式比较简单,仅仅需要背景色透明的话采用这种较...
MFC CEdit控件自绘、MFC圆角输入框 - C/C++ - 清泛网 - 专注C/C++及内核技术
...#include "MyEdit.h"
#include "../MemDC.h"
#include "../CommonFunc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNAMIC(CMyEdit, CEdit)
CMyEdit::CMyEdit()
{
//m_crText = RGB(40, 40, 40);
//m_crBorder = RGB(228,228,228);
m_clrBackground = RGB(255, 255, 255); //背景颜...
MFC AfxMessageBox改变标题的几种方法 - C/C++ - 清泛网 - 专注C/C++及内核技术
...的改法可能导致内存泄露,下面这样改就万无一失了:
if (m_pszAppName != nullptr)
{
free((void*)m_pszAppName);
}
m_pszAppName = _tcsdup(_T("What you want!"));
(完)
MFC AfxMessageBox 标题
解决WaitForSingleObject阻塞UI线程的问题 - C/C++ - 清泛网 - 专注C/C++及内核技术
...BJECT_0 + 1:
//get the message from Queue
//and dispatch it to specific window
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
DispatchMessage(&msg);
continue;
default:
break; // unexpected failure
}
break;
}
//显示主界面
...
使用 MsgWaitForMultipleObjects...
