c++

What's your favorite C++0x feature?

As many of us know (and many, many more don't), C++ is currently undergoing final drafting for the next revision of the International Standard, expected to be published in about 2 years. Drafts and papers are currently available from the committee website. All sorts of new features are being added, the biggest being concepts and lambdas....

How to create a very big bitmap in C++/MFC / GDI

I'd like to be able to create a large (say 20,000 x 20,000) pixel bitmap in a C++ MFC application, using a CDC derived class to write to the bitmap. I've tried using memory DCs as described in the MSDN docs, but these appear to be restricted to sizes compatible with the current display driver. I'm currently using a bitmap print driver ...

ncurses in windows

please list a ncurses libraries in C/C++ for windows that emulate ncurses in native resizable win32 windows NOT in console mode. ...

How much faster is C++ than C#?

Or is it now the other way around? From what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to test it by myself. Thought any of you could explain these differences in detail or point me to the right place for information on this. ...

How to programatically unplug & replug an arbitrary USB device?

I'm trying to fix a non-responsive USB device that's masquerading as a virtual com port. Manual replugging works, but there may be up to 12 of these units. Is there an API command to do the programatic equivalent of the unplug/replug cycle? ...

Get address of current page in Internet Explorer from toolbar

I'm trying to wrap my head around creating a toolbar (a tool band in a rebar) in MFC for Internet Explorer using COM. Is it possible to get the address of the currently viewed page (i.e., http://stackoverflow.com/questions/ask in my case :-) ) from the toolbar? If so, what should I look in to? Thanks! ...

Initializing a static std::map<int, int> in C++

What is the right way of initializing a static map? Do we need a static function that will initialize it? ...

How to add custom item to system menu in C++?

I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? Update. I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS and Ubuntu have such th...

Visual Studio debugger slows down in in-line code

Since I upgraded to Visual Studio 2008 from vs2005, I have found a very annoying behaviour when debugging large projects. If I attempt to step into inline code, the debugger appears to lock up for tens of seconds. Each time that I step inside such a function, there is a similar pause. Has anyone experienced this and is anyone aware of...

Is there an implementation for Delphi:TClientDataSet in C++ for MVS?

I want to migrate from Embarcadero Delphi to Visual Studio, but without a TClientDataset class it is very difficult. This class represents an in-memory dataset. I can't find any class like TClientDataset. Can anyone help me find something like this please? ...

Setting all values in a std::map

I'd like to set all the values in a std::map to the same value. Is there a method for this or do I have to iterate through the map and set them one by one? ...

Does the CAutoPtr class implement reference counting?

Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.). Does the CAutoPtr class implement reference counting? ...

Why would the Win32 OleGetClipboard() function return CLIPBRD_E_CANT_OPEN?

Under what circumstances will the Win32 API function OleGetClipboard() fail and return CLIPBRD_E_CANT_OPEN? More background: I am assisting with a Firefox bug fix. Details here: bug 444800 - cannot retrieve image data from clipboard in lossless format In the automated test that I helped write, we see that OleGetClipboard() sometimes...

Should Local Variable Initialisation Be Mandatory?

The maintenance problems that uninitialised locals cause (particularly pointers) will be obvious to anyone who has done a bit of c/c++ maintenance or enhancement, but I still see them and occasionally hear performance implications given as their justification. It's easy to demonstrate in c that redundant initialisation is optimised out:...

Indirect Typelib not imported well from Debug dll

Using VC2005, I have 3 projects to build: libA (contains a typelib, results in libA.dll): IDL has a line library libA { ... libB (contains a typelib importing libA, results in libB.dll): IDL has a line importlib( "libA " ); libC (imports libB): one of the source files contains #import <libB.dll> the #import <libB.dll> is handled by...

Vector or deque?

Between vector and deque in C++ which one should I prefer in what situations? ...

Track Data Execution Prevention (DEP) problem.

Hi, When running one of our software, a tester was faced with the data execution prevention dialog of Windows. We try to reproduce this situation on a developer computer for debugging purposes : with no success. Does anyone know how to find what may cause the DEP protection to kill the application? Is there any existing tools availab...

boost::shared_ptr STL container question

Assume I have a class foo, and wish to use a std::map to store some boost::shared_ptrs, e.g.: class foo; typedef boost::shared_ptr<foo> foo_sp; typeded std::map<int, foo_sp> foo_sp_map; foo_sp_map m; If I add a new foo_sp to the map but the key used already exists, will the existing entry be deleted? For example: foo_sp_map m; vo...

When to use dynamic vs. static libraries

When creating a class library in C++, you can choose between dynamic (.dll) and static (.lib) libraries. What is the difference between them and when is it appropriate to use which? ...

What's the best way to have a C++ member function get called by a C callback ?

Given a typical class: struct Whatever { void Doit(); }; Whatever w; what is the best way to get the member function to be called by a C void* based callback such as pthread_create() or a signal handler ? pthread_t pid; pthread_create( ...