visual-c++

How to check if a file can be deleted

I want to use it during uninstall procedure to warn the user ahead. The procedure should work for W2000+, hence Vista API's are not allowed. This seems to catch some conflicts: if( GetFileAttributes( lpPath ) == INVALID_FILE_ATTRIBUTES ) { // File does not exist } else { BOOL bCanDelete = FALSE ; HANDLE hFile = CreateFile( path, ...

Can You Use MSVC 6.0's Debugger to 'Step Into' a Macro?

I am using MSVC 6.0 to call a macro in the Win32API and I'm getting an access violation. I know that the pointers I'm passing to the macro contain valid addresses, though they're evidently not pointing to the correct data. The macro accepts multiple pointers, and I'm not sure which pointer is erroneous, so I'd like to use MSVC's debugg...

Trace an IP Address and find the owner

Is there any way to find the owner or the domain Example if i give the ip of google my tool find that ip of google this shoul be done address programatically most prefered programing language will be vc++ other language is also not a problem ...

Ascii to XML Character set conversion

Is there any classes to convert ascii to xml characterset preferably opensource i will be using this class either in vc++ or C# My ascii has some printable characters which is not there in xml character set i just tried to sen a resume which is in ascii character set and i tried to store it in a online crm and i got this error message ...

How do I set the icon for my program in Visual C++ 2008 Express Edition?

I want to set the embedded icon for my executable console program to a custom icon. I know this is pretty much the same question as this one here, but I'm using Visual C++ 2008 Express Edition, and the Resources View is not available (and the Project-context-menu->Add->Resource... is grayed out), so I'm at loss here. Will I have to upgr...

Can't find .lib file MSVC++ 2008

I am compiling my project with msvc++ 2008. I have added a reference path in project properties to ./lib, which is the directory that contains the file freeglut.lib. I have been very careful to organize everything nicely, and still msvc++ does not find the file :(. I checked the build log, to see that no where in the build command line d...

Are there any major differences between Visual C++ and C++

I want to make win32 apps and games. Is there any major differences between C++ and Visual C++? What should I use. ...

C++ Debug Problem - pdb file

I have several DLLs in my project that are defined to create their *.pdb file (debug info) inside the same folder. The problem is that the only *.pdb file that actually exist inside this folder is the one that belongs to the last compiled DLL. As a result I can debug only the last project (each compilation deletes all the *.pdb in the fo...

How do I integrate Boost into a Visual C++ project?

Hi all, I'm trying to link up some of the boost stuff with a visual C++ project of mine and am not sure what the best way to do this is, I'm specifically interested in the singleton class. ...

Is it possible to compile both 32-bit and 64-bit configurations without restarting Visual Studio?

Currently Visual Studio just starts cl.exe for C++ source compilation. cl.exe needs to be in one of folders listed on the %PATH% environment variable. Since there're separate versions of cl.exe for 32-bit and 64-bit compilation in order to compile a 32-bit project after compiling a 64-bit project it is necessary to restart Visual Studio...

VC++ Error on template inheritance

This is child's play, but I'm a bit of a vc n00b. I get an error: error C2143: syntax error : missing ',' before '<'. on the second line of the following code: template<int i, int j> class B : public A<i, j> { } template<int i, int j> class A { } Thanks for the help! ...

Why does ATL COM map scanning code expect the first entry to be of _ATL_SIMPLEMAPENTRY type?

ATL provides a bunch of macros for creating so-called COM maps - chains of rules of how the QueryInterface() call behaves on a given object. The map begins with BEGIN_COM_MAP and ends with END_COM_MAP. In between the the following can be used (among others): COM_INTERFACE_ENTRY, COM_INTERFACE_ENTRY2 - to ask C++ to simply cast this cla...

Illegal Instruction in service using SCM in VC++

Hi guys, I have issue in service created using VC++ code. as my ServiceMain function ends. it returns following error in End of the function(in release it crashes.) Unhandled exception at 0x0012e3b4 in Adiserv.exe: 0xC000001D: Illegal Instruction. i am unable to figure out the issue. can you help me out... Thanks Ashish ...

When implementing several COM interfaces at once how do I upcast to IUnknown?

Suppose my COM object implements two or more COM interfaces: class CMyClass : public IPersistFile, public IPersistStream { }; when implementing QueryInterface() I need to be able to return an IUnknown* pointer. Since both base interfaces are derived from IUnknown I cannot upcast implicitly - such upcast would be umbiguous. To upcast e...

Why exactly do I need an explicit upcast when implementing QueryInterface() in an object with multiple interfaces()

Assume I have a class implementing two or more COM interfaces: class CMyClass : public IInterface1, public IInterface2 { }; Almost every document I saw suggests that when I implement QueryInterface() for IUnknown I explicitly upcast this pointer to one of the interfaces: if( iid == __uuidof( IUnknown ) ) { *ppv = static_cast<IIn...

Why use CComBSTR instead of just passing a WCHAR*?

I'm new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this way. Would like to know what is the need for this. ...

using Math::Round with visual c++ in vs2008

I have the following visual c++ code #include <iostream> #include <string> #include <sstream> #include <math.h> using namespace std; int Main() { double investment = 0.0; double newAmount = 0.0; double interest = 0.0; double totalSavings = 0.0; int month = 1; double interestRate = 0.065; cout << "Month\tIn...

Get text width in MFC

I'm wanting to dynamically resize a CButton to the width of the text within it. Is there either a built-in way to do this in MFC, or a way of calculating the pixel width of some specified text (so that I can use CWnd::SetWindowPos)? ...

CVTRES : fatal error CVT1106: cannot write to file

Moving a project to different computer and trying to compile it there, produces the following error: CVTRES : fatal error CVT1106: cannot write to file .\Debug\Project.res : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt Environment is Visual C++ 6, but quick search from the internet hinted that it mig...

Why is this the same even when object pointers differ in multiple inheritance?

When using multiple inheritance C++ has to maintain several vtables which leads to having "several views" of common base classes. Here's a code snippet: #include "stdafx.h" #include <Windows.h> void dumpPointer( void* pointer ) { __int64 thisPointer = reinterpret_cast<__int64>( pointer ); char buffer[100]; _i64toa( thisPoin...