53)__stdcall 和__cdecl 是不同的,在回调函数的时候,一定要根据调用约定来定义,不然会出现堆栈错误;
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
54)vs2008 对对话框添加类后,在添加消息函数时,找不到添加的类;
关掉程序,删掉.ncb后,在打开程序即可!
55)
转化MFC CString to std::string
unicode下:
CString str = L"Test";
std::wstring ws(str);
std::string s;
s.assign(ws.begin(), ws.end());
56)成员函数中调用OnClose, 不能关闭对话框;
解决办法:在OnClose中调用CDialog::OnCancel();
57)如何在Combo Box控件中显示指定的字符串?
((CComboBox*)GetDlgItem(IDC_XXX_COMBO))->SetWindowText(strType);
注意将IDC_XXX_COMBO的type设置成Dropdown
58)win8 下IP 控件只能输入2位数,不能输入3位数字;
解决办法:将IP控件的宽度增大;
59)32位的程序FindFile,在64位的win7 下,不能判断system32下的文件是否存在?
60)win7 64位下安装directx 9c 出现TxView.dll 和Error S1023错误
解决办法:
1. Run this two commands.
MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}
卸载掉vs2010的运行库;
2)安装Install DirectX SDK( DXSDK_Jun10.exe)
3)安装directx 运行库
directx_Jun2010_redist.exe
61)vs2008 破解
1. 安装 VS2008 (如果你已经安装了,那忽略此项)
2. 打开 控制面板 –> 添加删除程序 , 找到 VS2008 的安装项,运行 VS2008的安装卸载程序;
3)然后打开破解程序CrackVS2008ForWindows7.exe,点击上面的 “Bug 微软”;
4. 输入相应的序列号,就可以啦;以下是收集的序列号:
1.Visual Studio 2008 Professional Edition: XMQ2Y-4T3V6-XJ48Y-D3K2V-6C4WT
2.Visual Studio 2008 Team Test Load Agent: WPX3J-BXC3W-BPYWP-PJ8CM-F7M8T
3.Visual Studio 2008 Team System: PYHYP-WXB3B-B2CCM-V9DX9-VDY8T
4.Visual Studio 2008 Team Foundation Server: WPDW8-M962C-VJX9M-HQB4Q-JVTDM
62)
虚拟光驱win7 下 vs2008 无法安装,安装对话框 弹出来马上消失
解决办法:使用虚拟光驱解压 提取vs2008 ,然后安装 又出现
vs2008安装错误 无法打开数据文件deffactory.dat
解决办法:
打开了指定目录下的DefFactory.dat文件发现里面是乱码,
在记事本中粘贴一下内容,将记事本名称改为“DefFactory.dat”,覆盖安装临时目录下的DefFactory.dat文件即可搞定。
[Version]
Signature=”$Windows NT$”
Provider=”Microsoft Visual C++ 2008 Express Edition - ENU”
Version=900.100.00
NullString=Null String
BootstrapperURL=fwlink/?LinkId=95926
NewVersionURL=fwlink/?linkid=96095
Lang=1033
AdminModeSupported=0
[Scenario List]
vsscenario.dll
[Scenario Factory Information]
Default Scenario=11E4C8F3-425E-43b9-B689-8BFDF03342E2
63)vs2008 fatal error C1083: 无法打开包括文件:“afxwinappex.h”: No such file or directory
安装vs2008 sp1 补丁。
64)linux 虚拟机 键盘不灵
你的是笔记本吗?如果是就按下Fn+F8,不是的话就按下numlock,要在虚拟机里面按下;
65)error C2660: “CWnd::PostMessageW”: 函数不接受 4 个参数
::PostMessage(pThis->m_hwnd,WM_PARAM_ACK_PARSER,(WPARAM)&cmdType,(LPARAM)&ackStatus);
66) CFileDialog 选中多个文件,文件名截断问题
CFileDialog dlg(TRUE,0,0,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR|OFN_ALLOWMULTISELECT,lpszFilter);
当选中多个文件时,文件名截断了,应该是文件的路径长度有限制;
解决办法:定义一个大的Buff,window 默认文件长度最大为512,解决例子如下:
#define BUFFER_SIZE 16*1024
//避免选择多个文件,文件名截断,定义一个大的Buff
TCHAR szLargeBuf[BUFFER_SIZE];
memset(szLargeBuf,'\0',BUFFER_SIZE);
//
LPCTSTR lpszFilter=_T("data (*.data)|*.data|All Files (*.*)|*.*||");
CFileDialog dlg(TRUE,0,0,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR|OFN_ALLOWMULTISELECT,lpszFilter);
dlg.m_ofn.lpstrFile = szLargeBuf;
#ifdef UNICODE
dlg.m_ofn.nMaxFile = BUFFER_SIZE;
#else
dlg.m_ofn.nMaxFile = sizeof (szLargeBuf);
#endif
//获取视频文件名
if (dlg.DoModal() == IDOK)
{
}
67)MFC 对话框程序进程不能退出的解决办法,在OnClose中加入:
HANDLE hself = GetCurrentProcess();
TerminateProcess(hself, 0);
http://www.cnblogs.com/shootingstars/archive/2004/07/15/24602.aspx
68)vs2008 如何打包COM 并注册DLL
点击com的dll的右键,属性Register 选择vsdrfCOMSelfReg;
69)fatal error C1853: “Debug\***.pch”意外的预编译的头,只需重新运行编译器可能会解决此问题。
安装sp1的补丁;安装补丁 VS90SP1-KB976656-x86.exe
70)如何使主窗体最小化的时候,其非模态对话框不跟随它一起最小化;
创建非模态对话框时,将父窗口指定为桌面;GetDestopWindow();
71)包含CString的结构体不能使用了memcpy,因为CString是一个指针;
不然会造成指针越界等问题;
72)调用OnClose函数,如果其它线程正在操作MFC的控件,控件会死锁;
解决办法:使用Event或等待线程句柄退出
{
DWORD dRet;
int nExitThreadCount = 0;
MSG msg;
BOOL bWaitAll = FALSE;
int nWaitCount = MAX_NUM;
{
dRet = MsgWaitForMultipleObjects(nWaitCount, m_hThreadArray, bWaitAll, INFINITE, QS_ALLINPUT);
if (dRet == WAIT_OBJECT_0 + nWaitCount)
{
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else if (dRet >= WAIT_OBJECT_0 && dRet < WAIT_OBJECT_0 + nWaitCount)
{
{
//
nExitThreadCount++;
int nIndex = dRet - WAIT_OBJECT_0;
m_hThreadArray[nIndex] = m_hThreadArray[nWaitCount - 1];
m_hThreadArray[nWaitCount - 1] = NULL;
nWaitCount--;
}
else
{
break;
}
}
else
{
DWORD dErrCode = GetLastError();
break;
}
}
}
73)MsgWaitForMultipleObjects不能正常等待线程退出?
MsgWaitForMultipleObjects不能正常等待线程退出,原因是开辟线程时,用的_beginThread,这个函数返回的不是一个有效的Handle;改为CreateThread,解决;
更新或者提交前执行一下clean up。如果在当前目录执行该命令后,仍然提示锁定,就到上一层目录再执行下...
75)如何动态修改对话框标题栏的文字
CString strmsg;
strmsg.LoadString(IDD_XXX_SET_DIALOG);
this->SetWindowText(strmsg);
76)
MFC的listctrl控件中水平添加按钮并刷新
http://www.cppblog.com/Tim/archive/2014/05/10/206884.html
77)vsprintf.c buffer too small
sprintf_s 内存分配不够。
78)access 数据库插入数据报错
可能要安装一个数据库引擎 http://jingyan.baidu.com/article/7082dc1c504816e40b89bd6a.html
安装AccessDatabaseEngine(2007)版的开发程序包,下载链接http://www.microsoft.com/zh-cn/download/details.aspx?id=23734,安装后调试代码,顺利通过问题解决!
79)vs2010 va Alt+G 失效问题
http://blog.sina.com.cn/s/blog_5d2118510100ftze.html
前几天,装了vc6,vc7,vc8,vc9等几个版本。累了一身汗的说。
然后,兴高采烈的装了vistual assist x ,但是装完后,打开vs2005,发现最爽的快捷键alg+g不能用了!囧
在va的官方网站上,找到了原因。
官方说必须设定解决方案模式为default,否则不可见,自然Alt+G就无效。
在option->envirenment->keyboard 将solution 改为default,
在filter中输入vassistx,下面就给出很多va的命令,找到vassistx.gotoimplementation ,下面显示命令键为Alt+g(文本编辑器),快捷键是没错,那问题估计就是文本编辑器这几个字了。
在下面重新分配快捷键试试,命令范围选中“全局”,设定快捷键Alt+G。确定后,问题解决。
顺手又将常用的几个命令,设定为global.
ps.发现默认情况下vs中Alt+G和lingous冲突。建议对lingous中"屏幕取词开关"快捷键冲突。可以换个lingous里的快捷键。不过,我lingous就没用过快捷键,直接禁用热键···此为,这个方法不是万能的,可能还有其它因素致使Alt+G不能用。
官方文档,粘贴如下。
http://www.wholetomato.com/products/features/shortcut.asp
Shortcuts Listed in IDE Dialogs
Default shortcuts appear in the options dialog of Microsoft Visual Studio .NET only when the Keyboard mapping scheme is set to [Default Settings]. Default shortcuts do not appear if you use any other scheme. For example, you do not see the default for VAssistX.GotoImplementation if your scheme is set to Visual C++ 6.
p.s. 这几天突然又不好用了。装了个resharper,把快捷键都冲突了。无奈下,对键盘 reset了一下。好使了,原因不明。囧~
80) vs2010 启动时项目时加载文件,启动很慢?
打开vs2010菜单工具 -选项-常规-视觉体验,这里的3项都不要勾选