visual-c++

Weird Debugger Behavior

The following code snippet behaves in Debug mode (VC++ 2005) differently than in Release: HANDLE hFileRead; hFileRead = CreateFile(pszListFile, // lpFileName, GENERIC_READ, // dwDesiredAccess, FILE_SHARE_READ, // dwShareMode, NULL, ...

What is the "^" symbol in C++?

Has a new symbol joined the C++ language specification while I was sleeping under a rock? I just encountered the following question: http://stackoverflow.com/questions/3621649/restrict-text-box-to-only-accept-10-digit-number-c Which suggests that the '^' symbol is somehow part of C++ (not in the legacy meaning of a bitwise-XOR) Is th...

Intellisense ctrl+space in visual studio 2010

I'm writing a small program using CLR console application and when I write something it doesn't give suggestions, although i press (Ctrl+Space). I'm using visual studio 2010 can any one help me? ...

winsock2.h, no such file or directory

I have this error while compiling my Visual C++ project in Visual Studio 2008 on XP. How to resolve this error :( Error 1 fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlbase.h 68 WOT ...

Any negative outcome from writing a function body on a separate line?

I'm reviewing our Visual C++ code base and see lots of helper functions with really short bodies. Like for example this: inline int max( int a, int b ) { return a > b ? a : b; } the problem is when code is debugged in Visual Studio debugger it's impossible to immediately see what a and b are upon entering the function with F11 ("step ...

C++ Service Error While Starting : Could not Start the Service on Local Compueter

I have created a Win32 Service using C++ and installed to the Services Successfully. Now While I try Starting the service from Services.msc , I am getting the Error: Could not start the Service on Local Computer . Error 2: The system can not find the File specified. Here is the code snippet I am defining in the Service Entry Point: #i...

is it possible to use OpenGL for drawing in WinCE ?

Hi, For drawing graphics on WinCE emulator in visual studio 2008, currently i am trying to use GDI in VC++. is it possible to use OpenGL for drawing on WinCE platform ? ...

How do i write a log file in VC++ for a particular application?

How do i write a log file in VC++ for a particular application? ...

Calling protected method in base class via pointer to base class in derived class

Hello, I would like to understand why when I call protected method, declared and implemented in base class, from derived class via pointer to base class I get compilation error (C2248) and when I call it from derived class via pointer to derived class instance, compilation pass. I understand it is part of the language but I want to und...

C++ templated function and forward declarations

I'm working on some code that compiles and links (and even has released commercial products) on Windows using MSVC. It doesn't compile with GCC though, I get the following errors: .../CBaseValue.h: In member function 'bool CBaseValue::InstanceOf()': .../CBaseValue.h:90:18: error: invalid use of incomplete type 'struct CValueType' .../CB...

C++ IWebBrowser2 - IE - Access Image Cache

Hello, I am currently automating some requests with the IWebBrowserApp Object. Now I want to save an image, that is NOT saved in Cache (due to http headers). Also I can not just download it from the image url, not even when using a second IWebBrowserApp Object and getting the response as stream (html code, or server errors to prevent dow...

how to draw a graph control in MFC VC++ Visual studio 2008 ?

Hi, I need to draw a graph which can be updated continuously on WinCE platform. For that, is there any built-in control available in MFC VC++ VS 2008 ? ...

c++ vectors causing break in my game

my works like this i shot airplanes and if the shot toughed an airplane it change there positions(airplane and the shot) than it will delete them. if i toughed an airplane the airplane position gets changed. than it gets deleted than my health reduces. well that works well expect that it breaks when i have about 2-4 airplanes left and i ...

How Can I access Windows Service Object by Another Programme

I have a windows service which is creating a Named Pipe in it's service main Function. The code snippet is below: void WINAPI ServiceMain(DWORD argc, LPTSTR *argv) { DWORD status; DWORD specificError; m_ServiceStatus.dwServiceType = SERVICE_WIN32; m_ServiceStatus.dwCurrentState = SERVICE_START_PENDING; m_ServiceStatus.dwContro...

How to test if a constant fits into a type while compiling?

I'd like to add compile time asserts into the following C++ code (compiled with Visual C++ 9): //assumes typedef unsigned char BYTE; int value = ...; // Does it fit into BYTE? if( 0 <= value && value <= UCHAR_MAX ) { BYTE asByte = static_cast<BYTE>( value ); //proceed with byte } else { //proceed with greater values } The ...

Install DLL Server on x64 Windows

I need to install a shell extension (64-bit DLL server) for the contextual menu on any version of Windows x64. I'm able to register the extension just fine (regsvr32) if on the target system I have installed the redistributable files for VS 9.0 SP1 x64 (setup file from Microsoft). However I have to make a setup and cannot require the us...

Default folder for new files in Visual C++

Hi, I have created a Visual C++ project from existing source files. The .vcproj-File is not in the same location where my .cpp and .h files are. Can I tell Visual Studio to create new files in that specfic folder rather than the project directory? Thank for any hints! ...

datatype info over socket; dynamic initialize?

I have data coming over a socket that looks like this: (h)(int,char,float,int,char)(/h)(d)(2,a,1.32,45,d)(3,d,3.45,32,a)(/d) The datatype of the data arriving is dynamic and is only known when the header is received. I then have to create corresponding std::vectors to store the data. In this case, two int, two char and one float vecto...

Why does a struct consisting of a char, short, and char (in that order), when compiled in C++ with 4-byte packing enabled, come to a 6-byte struct?

I thought I understood how C/C++ handled struct member alignment. But I'm getting strange results for a particular arrangement in Visual Studio 2008 and 2010. Specifically, I'm finding that a struct consisting of a char, short, and char is compiled into a 6-byte struct, even with 4- or 8-byte packing enabled. I am at a loss as to why th...

WCF service with wsHttpBinding and x509 Certificate - can I consume/connect using VB/C# WITH PHP?

We connect to a web service hosted by another company. We send a customer's basic info to the service, and it replies with rates/prices for that customer. I am a PHP guy -- started out playing with basic HTML, then delved into PHP about 8 years ago, and my entire web app is PHP with javascrtipt/ajax mixed in as needed. I'm a learn-as-...