visual-c++

Top-level .mak file for Visual Studio?

I've inherited a body of Visual C++ source that consists of about a dozen sub-projects. One of these is an empty "MakeAll" project that depends on all the others, so I can build the entire project by setting the MakeAll project active and selecting "Build All." I'd like to automate this process, and coming from a linux environment, my ...

_configthreadlocale and localeconv

As we all know, global data, like the locale settings affecting the numeric decimal point printf() and strtod() are using, is evil. Fortunately, MSVC++ 9 allows to use per-thread locales by a _configthreadlocale(_ENABLE_PER_THREAD_LOCALE) call. Unfortunately, it seems that the localeconv() function does not notice this and still returns ...

How to implement CEditListCtrl

How to implement CEditListCtrl?. List control with edit capabality (Report/Grid view). I have a list view in Report View. It has some values. I need to extend this to edit the values present in the list view. I declared a class which inherits from CListCtrl. And I have handled the two Window messages to start and end the edit. Upon getti...

suppress autoplay

I need to suppress autoplay for the mass storage devices. This needs to be achieved programatically through a service/deamon running in the background. I know it can be done by an application which opens a window and handles the "queryCancelAutoPlay" message sent by windows. Can this be done without GUI.I have the guid/pid/vid for the ...

Win32 WriteProcessMemory() magical offset value

I'm trying to read the data in a Win32 ListView owned by another process. Unfortunately, my WriteProcessMemory() call fails with the error "This function is not supported on this system." when I specify "NULL" for the base address in my VirtualAlloc() call. If, however, I offset that VirtualAlloc() address by some "magic" value that I go...

What Windows API do I choose for a rich client application?

I develop rich client software on Mac OS X and Linux. I wish to port an application to Windows and not being a user of Microsoft products, I'm not very familiar with Windows in general. What I'm familiar with: On Mac OS X, I have the option of Cocoa and Objective C or Carbon and C/C++. On Linux, I have the option of GTK+ and C/C++ or Q...

What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?

Background There are several different debug flags you can use with the Visual Studio C++ compiler. They are: (none) Create no debugging information Faster compilation times /Z7 Produce full-symbolic debugging information in the .obj files using CodeView format /Zi Produce full-symbolic debugging information in a .pdb file for th...

What are the pros + cons of Link-Time Code Generation? (VS 2005)

I've heard that enabling Link-Time Code Generation (the /LTCG switch) can be a major optimization for large projects with lots of libraries to link together. My team is using it in the Release configuration of our solution, but the long compile-time is a real drag. One change to one file that no other file depends on triggers another 45 ...

Visual C++ TDD setup

I haven't worked much with Visual Studio before. I've started a personal project in my spare time and I would like to use test-driven development since it has been a huge benefit to me in my Java development. I started this project quite a while ago, and I used CppUnit. I know there are probably other frameworks that are better, but this...

Is it really worth porting from VC6 ->vc2005,2008?

What are all the problem that you foresee in doing that. ...

Changing path for custom build step

I have inherited a visual studio 2003 project which uses some custom build steps. I'm having some trouble with the path to the tool. Where does visual studio get its PATH? I've echoed out %PATH% in the custom build step and it has no resemblance to the system path. I did find a value in the registry HKEY_LOCAL_MACHINE\SOFTWARE\Micro...

delete and delete [] the same in Visual C++?

I know that I am supposed to use delete [] when I used new [], so using auto_ptr with new [] is not such a bright idea. However, while debugging delete [] (using Visual Studio 2005) I noticed that the call went into a function that looked like this: void operator delete[]( void * p ) { RTCCALLBACK(_RTC_Free_hook, (p, 0)) operat...

Printing the stack trace in C++ (MSVC)?

In my C++ application (developed with Visual Studio 2003) and Qt4, I'd like to print the stack trace from a specific line of code, either to the console output or into a file. What would it take ? Is Qt of any help to do this ? ...

How can one inspect a vtable in Visual C++?

Suppose one had inherited a complex codebase (in Visual C++, assume 2003 or perhaps later) with a large and complex inheritance graph. Suppose it's deep, and there's lots of virtual functions and possibly even multiple inheritance as well. (Yes, a bit of a maintenance nightmare). Any attempt to refactor this class hierarchy into somethin...

Building console apps without CRT & default headers?

I'm trying to build a console application without using the CRT, or any other imports than kernel32.lib in any case. I get my code to compile, but can't wrap the linker around a few problems: unresolved external symbol @__security_check_cookie@4 unresolved external symbol "int __cdecl FreeLibrary(void *)" (?FreeLibrary@@YAHPAX@Z) unreso...

CreateProcess from memory buffer

I can use CreateProcess to launch an EXE. I want to have the contents of an EXE in a memory buffer and do CreateProcess (or an equivalent) on it without having to write it to a file. Is there any way to do that? The backstory : we make games. We send a plain EXE to our distributors, which then wrap it using their favorite DRM and sell i...

What is the strtok_s equivalent in VC7?

The strtok_s function exists in vc8 but not in vc7. So what's a function (or code) that does the equivalent of strtok_s in vc7? ...

sqlnclir.rll being loaded and unloaded continuously

I'm working with SQL Native Client 9 in a C++ application that communicates with SQL Server 2000. I'm working on debugging things right now but something I've noticed that bothers me (mostly because it's creating significant clutter) is that sqlnclir.rll is being loaded and unloaded continuously and the following lines are being spammed...

How do I add an ActiveX component to my project in Visual C++ 2008

I am just learning Visual C++ and I am used to Visual Basic where I just select the ActiveX component from a list of references. I can seem to add it anywhere. If I go to the Project | References, it is all blank. It only allows me to specify a path and when I specify the path of the AcitveX component, nothing new happens. I dragged ...

Change the location of the ncb file in Visual C++ 2008 (9.0)

I´ve tweaked the VC++ settings so that all of my actual code will go to one place, while compiler generated binaries will go to another. This ncb file is the exception though. It is a quite large IDE generated binary file (Intellisense database). I can´t seem to be able to move it anywhere other than the solution folder. I´ve reasearched...