visual-c++

What makes deployment successful for some users and unsuccessful for others?

I am trying to deploy a Visual C++ application (developed with Microsoft Visual Studio 2008) using a Setup and Deployment Project. After installation, users on some target computers get the following error message after launching the application executable: “This application has failed to start because the application configuration is in...

Where should I be using a static library in C++

What are the use cases of using static libraries in C++? I have seen that people create DLLs instead or some that use static libraries only. Whats your recommendation? ...

How to recover from MFC error "Cannot add new member"?

I'm working with an MFC application using Visual C++ 6.0. When I double-click on one of the elements of a dialog box in Resource View, I get the error "Cannot add new member." I understand that the source of this might be corrupted metadata in the source files associated with that resource. Do you know any methods for determining what ...

[windows] Why so many msvcp80.dll?

My computer have so many msvcp80.dll in different directory. and there are different versions: 8.00.50727.762 8.00.50727.1433 ... applications uses the version under their directory as Private Assemblies with advantages. And also I found a copy of msvcp80.dll under c:\windows\system32. Can I find out which application installed thi...

Installing LEX/YACC or flex/bison on Windows, Visual C++ 2008

There's too much bytes and too few information in Internet, so I decided to ask if someone have already done such an installation. How to compile/where to download binaries? Where can I find a build rule? Where can I find a bunch of good samples (with associativity resolution, symbol tables etc.)? ...

Memory management with HEAP arrays

Hello everyone, If i create a heap array inside a loop, do i have to delete it at the end of each loop before i reinitialize it at the beginning of the loop again or will reinitializing the exact same thing again simply overwrite the old array and i can just skip the delete command? ...

How to better initialize a reference counter for a non-creatable COM object?

I have a COM interface with a method that returns an object: interface ICreatorInterface { HRESULT CreateObject( IObjectToCreate** ); }; The key is that calling ICreatorInterface::CreateObject() is the only way to retrieve an object implementing IObjectToCreate interface. In C++ I could do it this way: HRESULT CCreatorInterface...

Why building the same project generates different EXE file for each developer

My team and I are developing a VC++ 6 project. We are all using the same code-base (using version control system), and all our compiler/linker/environment-settings (including include directories order), as far as we can tell, are exactly the same. Of course we are using the same VC++ version with the same service packs (VC6 SP6). The pr...

porting to vs2005 from VC6

i was getting an link error mfc42.lib cant be opened, while porting vc6 to vs2005, i added the lib path form vc6 directory to vs2005 option, but nw i am getting error link2001 unresolved external symbol "unsigned int (__stdcall* ATL::gfunc() ...

Which error code to return when a passed object doesn't implement a necessary interface?

In COM when I have a well-known interface that I can't change: interface IWellKnownInterface { HRESULT DoStuff( IUnknown* ); }; and my implementation of IWellKnownInterface::DoStuff() can only work when the passed object implements some specific interface how do I handle this situation? HRESULT CWellKnownInterfaceImpl::DoStuff( ...

Using cl.exe from a C++ program.

My command wants to code a fast unit-test. We have lots of .cpp files that are tests of a library. The main idea is to generate precompiled header once, then build each .cpp file separately into .obj file. It must be done without a project having all these inside, since we want to know what particular .cpp failed, but all other compiled ...

How to display or view exception thrown by c# code in c++ program

Iam calling the functions using SMO of a c# dll in a c++ project but the code in that dll is throwing some exception, so how can I display the exception message in my C++ code ...

How to display exception message of managed C# code in c++ code

Iam calling the functions using SMO of a c# dll in a c++ project but the code in that dll is throwing some exception, so how can I display the exception message in my C++ code ...

Using in the same time Boost in release and debug mode

Hello, The title is just for teasing. :-) I know it isn't possible, but here is my problem. My app (a DLL, actually) uses Boost. It also uses an external API, which also uses Boost. The external API is of course provided in a release binary, anlong the needed release Boost binaries. When I compile/link my DLL in release mode, I have n...

Directing a VC++ app to use older VC80.CRT version

Hello, I have a VC++ managed app that was built and tested against VC80.CRT version 8.0.50727.762. I verified that the embedded manifest points to 762, and the build machine has 762 as the latest VC80.CRT version. The app has now been also run on a machine that has both 762 as well as a later version of the runtimes (4053). Both mac...

Conways's Game of life array problems

I'm writing a Conway's life game for school. In the program I am having trouble with the arrays taking the values I am assigning them. At one point in the program they print out the value assigned to them (1) yet at the end of the program when I need to print the array to show the iterations of the game it shows an incredibly low number....

Is Visual Studio 2005 Express Edition still legally available anywhere?

All the links on the Microsoft site now redirect to the 2008 edition. The problem is the new version won't link with C libraries built with the 2005 edition. ...

Finding memory allocation error

I'm getting memory allocation errors (and a subsequent crash) on the following simplified code: std::wstring myKey = L"str_not_actually_constant"; MyType obj; Read( obj ); std::map<std::wstring, MyType> myMap; myMap[myKey] = obj; // Sometimes allocation error (1) ... Read( MyType& obj ) { obj.member1 = ReadFromFuncThatMayBeProblem()...

Finding a window and setting focus on it...

1.I want to find a window and set focus on it , but window is not taking the focus. 2.If i use HWND_TOP then it does not make the window active and if i use HWND_TOPMOST then it make window always on top. Can anyone help me ?? HWND hwndAppDlg = ::FindWindowEx(hwndDesktop,NULL,lpszClass,lpszWindow); if(hwndAppDlg && IsWindow(hwnd...

How to best convert CString to BSTR to pass it as an "in" parameter into a COM method?

I need to convert a CString instance into a properly allocated BSTR and pass that BSTR into a COM method. To have code that compiles and works indentically for both ANSI and Unicode I use CString::AllocSysString() to convert whatever format CString to a Unicode BSTR. Since noone owns the returned BSTR I need to take care of it and relea...