有没有办法在Visual C++中为Visual Studio 2005获取Intellisense?
我正在尝试使用intellisense和对象浏览器/类视图中的Boost库加载.
我使用BoostPro安装程序(BoostPro 1.40.0 Installer)安装了Windows二进制文件.
我不确定它是否带有源代码,但可能需要使Intellisense在VS2005中工作.
使用glDrawElements()时,我遇到了一个可疑的错误.我正在尝试渲染简单的图元(主要是矩形)以加快文本的绘制等等,但是当我调用glDrawElements()时,整个屏幕闪烁黑色(不仅仅是我的窗口区域)一帧左右.下一帧它变回与以前相同的"Windows颜色".所以它闪烁了几秒钟,最后在一个消息框中说
The NVIDIA OpenGL Driver encountered an unrecoverable error
and must close this application.
Error 12
Run Code Online (Sandbox Code Playgroud)
在调用glDrawElements()之前,我需要重置GL的任何设置吗?我知道这不是一些悬空的glEnableClientState(),我检查了它(我曾经有过其中一个,但后来glDrawElements()崩溃了).
想到它,它几乎看起来像一些后台缓冲区错误...有什么想法尝试?
我无法理解编译器.以下代码在g ++下的UNIX中可以正常工作,但在VC++下它甚至不能编译.任何人都可以提供有效理由吗?
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string tmp_nw_msg, crc_chksum, buffer;
cout << "Enter the string : ";
cin >> buffer;
if (strlen(buffer.c_str()) >15 ) {
tmp_nw_msg = buffer.substr(1,12);
crc_chksum = buffer.substr(13,2);
cout << " N/W msg : "<< tmp_nw_msg << endl;
cout << " crc chksum : "<< crc_chksum << endl;
}
else {
cout << "error" << endl;
}
std::cin.get();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
VC++抛出以下错误,但在g ++中它确实可以正常工作.
错误1错误C2679:二进制'>>':找不到哪个运算符采用'std :: string'类型的右手操作数(或者没有可接受的转换)c:\ documents and settings\my …
我正在尝试将一些代码从VC9移植到G ++,但是我遇到了模板特化的问题,显然不允许类成员使用.
以下代码是类方法的getValue特化的这些错误的示例.在所有情况下,错误都是"错误:非命名空间范围中的显式特化class ..."
template<typename T> T getValue(const_iterator key)const
{
try{return boost::lexical_cast<T>(key->second);}
catch(boost::bad_lexical_cast &e)
{
throw TypeParseError<T>(name, key->first, e.what());
}
}
template<typename T> T getValue(const std::string &key)const
{
iterator i = find(key);
if(i == end())throw KeyNotFound(name,key);
else return getValue(i);
}
template<> std::string getValue<std::string>(const_iterator key)const
{
return key->second;
}
template<> std::string getValue<std::string>(const std::string &key)const
{
const_iterator i = find(key);
if(i == end())throw KeyNotFound(name,key);
else return i->second;
}
Run Code Online (Sandbox Code Playgroud)
它是否只是不支持确切的语法,并且一个小的更改将使它工作,或者我是否需要更改代码以避免像这样的专业化?如果后者这是一般的最佳方式吗?
我正在用C++创建一个简单的GUI,里面有几个按钮.我想点击这些按钮时启动一些外部.exe文件.
实现这个目的的代码是什么?
我需要一种方法来获取IE的所有选项卡的以下数据:
实际上我的客户希望保持员工上网行为的标签,他有这个要求.我不知道我怎么做到这一点.我想它将在VC++/Delphi中完成,任何技术都会做,只要能够为此生成一个可执行文件.
任何帮助,将不胜感激.
问候
Gaurav Verma
我正在尝试在最新的Visual Studio(2008)中重新编译旧代码,而以前工作的代码现在无法编译.其中一个问题是由于我班级的操作员超载.下面有一个简化的类来演示这个问题.如果我删除int和char*的转换运算符,那么它工作正常.因此,修复我的问题的方法之一是用过程to_char和to_int替换它们并使用它们,但它需要在代码中进行大量更改(该类被大量使用).必须有一些更好,更智能的方法来解决它.任何帮助是极大的赞赏 :-)
class test
{
public:
test();
test(char* s2);
test(int num);
test(test &source);
~test();
operator char*();
operator int();
};
test::test() {
}
test::test(char* s2) {
}
test::test(int num) {
}
test::test(test &source) {
}
test::operator char*() {
}
test::operator int() {
}
test test_proc() {
test aa;
return aa;
}
int test_proc2(test aa)
{
return 0;
}
int main()
{
test_proc2(test_proc());
}
//test.cpp(60) : error C2664: 'test_proc2' : cannot convert parameter 1 from 'test' to 'test'
// Cannot copy …Run Code Online (Sandbox Code Playgroud) 我最近看到此有关检测的Windows的“真实”的版本问题#1。
我有一个使用仅在Windows Vista及更高版本上可用的代码的应用程序。为了保持与Windows XP的兼容性,我创建了自己的版本,该版本与Vista代码完全相同,但与Vista代码的速度相差无几。当前,当从GetVersionEx()中检测到XP时,将加载XP代码。但是,显然,当应用程序在XP兼容性下运行时,此代码会不必要地加载。现在我知道我可以检查Vista方法,但是我的代码使用了很多仅Vista的代码,我宁愿不必检查该方法是否存在,因为我已经编写了XP检查,并且更改起来会更容易一个功能。
现在我的问题是:如何运行此WMI查询并以int AND std :: string形式返回结果(Windows版本):“从Win32_OperatingSystem中选择版本”
我正在使用VC ++ 2008。
我的电脑msvcp80.dll在不同的目录中有这么多.并且有不同的版本:
8.00.50727.762
8.00.50727.1433
...
Run Code Online (Sandbox Code Playgroud)
我还找到了msvcp80.dll的副本c:\windows\system32.
c:\windows\system32\msvcp80.dll吗?感谢您的回答和评论提前.
我想找一个窗口并设置焦点,但是窗口没有关注.
2.如果我使用HWND_TOP,那么它不会激活窗口,如果我使用HWND_TOPMOST,那么它会使窗口始终位于顶部.
谁能帮我 ??
HWND hwndAppDlg = ::FindWindowEx(hwndDesktop,NULL,lpszClass,lpszWindow);
if(hwndAppDlg && IsWindow(hwndAppDlg))
{
CRect rcAppDlg;
if( 0 == ::GetWindowRect(hwndAppDlg,rcAppDlg))
{
OutputDebugString(L"\n GetWindowRect failed...");
return FALSE;
}
if(0 == ::SetWindowPos(hwndAppDlg,HWND_TOPMOST,rcAppDlg.left,rcAppDlg.top,rcAppDlg.Width(),rcAppDlg.Height(),SWP_SHOWWINDOW))
{
OutputDebugString(L"\n SetWindowPos failed...");
return FALSE;
}
if(0 == ::PostMessage(hwndAppDlg,WM_SETFOCUS,0,0))
{
OutputDebugString(L"\n WM_SETFOCUS failed");
return FALSE;
}
return TRUE;
}
Run Code Online (Sandbox Code Playgroud)