c++

Check for interactive whiteboard or projector

I want to check that there is an interactive whiteboard or projecttor attached to the system. Actually I would like to check it is not there. (To be able to make different license levels.) Is there any technique which could be sure? Platform: MS Windows XP/Vista, MS Visual C++ ...

How do you make a HTTP request with C++?

Is there any way to easily make a HTTP request with C++, are there any libraries that do this. Specifically, I want to download the contents of a page (an API) and check the contents to see if it contains a 1 or a 0. Is it also possible to download the contents into a string? Code samples would be good. ...

< & > are converted to &gt; &lt; etc

I am using MSXMl library to parse xml after I call put_text and then get_xml the output will have < & > converted to &lt; & &gt; How can i get rid of this? ...

Windows Folder Share API

Hi, is there a WIN32 API available to manage folder sharing in Windows? Some links to examples will be helpful. Thanks. ...

Why does std::string.find(text,std::string:npos) not return npos?

I am doing a series of searches in a string, and somewhere along the line one of the strings will be missed, and my set of searches should fail. I had expected that once the position reached std::string::npos it would stay there, but it does not. Passing std::string::npos to std::string.find seems to start the search at the beginning ag...

Using try/catch in WindowProc MFC

If I use try/catch in WindowProc override of MFC window/view classes there is a performance hit. Why is it so and what is the alternative ? This I caught as a result of profiling. Removing the block makes the function consume much lesser time. I am using MS VS 2008. ...

How do I get total GPRS usage in KBs on a Windows Mobile Device?

Anyone knows how to do this programmatically? I looked at the registry keys but I couldn't find anything. I don't know maybe I missed it. Under the registry key HKLM/Software/Microsoft/shell/cumulativecalltimers/line_0/ there are the values "OutgoingDataPhoneLifeTime" and "OutgoingDataPhoneLifeTimeNumCalls"; but these don't seem to be w...

C++ File Reading Library - ANSI and Unicode

I've read a few answers on here about reading Unicode files etc and most people point to UTF8-CPP or iconv. None of the libraries that I found work for both ANSI and Unicode files, ideally I want one function which I pass a filename to and it will return the contents of that file and it won't matter what the encoding is, or is that not ...

compile different code on whether a function is available or not

Windows provides only GetTickCount up to Windows Vista and starting from that OS also GetTickCount64. How can I make a C program compile with calls to different functions? How can I make a C compiler check whether a function is declared in the included header files and compile different portions of code depending on whether that particu...

std::string to float or double

Hello, i'm trying to convert std::string to float/double. I tried: std::string num = "0.6"; double temp = (double)atof(num.c_str()); But it always returns zero. Any another ways? You could see debugger result in this screen: ...

How do I set the DPI of a scan using TWAIN in C++

I am using TWAIN in C++ and I am trying to set the DPI manually so that a user is not displayed with the scan dialog but instead the page just scans with set defaults and is stored for them. I need to set the DPI manually but I can not seem to get it to work. I have tried setting the capability using the ICAP_XRESOLUTION and the ICAP_YRE...

C++ Xml Comments issues for the List<> Type

I’m suffering from an issue, may be the bug of Microsoft. While creating the XML documentation for a managed C++ project, the methods those have the List type parameter shows the error in help file which I had created using the sandcastle utility. The same work fine for C# project. I’ve tried to know the reason for this and compared the...

std::fstream files more than 2gb

what strategy should i use if i have an implimentation of std::fstream with 32-bit std::streampos? If i want to move position i can do it in several steps(10gb - 10 times +1gb). How can i get position? Or should i keep current position in some variable outside fstream? ps i can't change the implimentation of stl. ...

Code coverage percentage not good

Hello, I have installed on my computer C++Test only with UnitTest license (only Unit Test license) as a Visual Studio 2005 plugin ( cpptest_7.2.11.35_win32_vs2005_plugin.exe ). I have a sample similar to the following: bool MyFunction(... parameters... ) { bool bRet = true; // do something if( some_condition ) { ...

Scaling in boost::spirit's assign_a

Hey folks! I am diving into boost::spirit in order to parse a ASCII-based protocoll. I mananged to extract values from the line using rules like this: rule<> Speed = uint_parser<unsigned int,10,3,3>()[assign_a(buffer.speed)]; I also succeed to connect these rules in a meaningful manner. What is missing for a perfect day is the follow...

Using a base-class object to represent its derived-class objects

I need a way for a single variable to represent two kinds of objects derived from the same base class. It's kinda hard to describe but I'll try the best: Say the base class: class Rectangle { float w; float h; const float area() {return w*h;} }; And the two derived classes: class Poker : Rectangle { int style; // Diam...

Finite State Machine compiler

What is the best Opensource FSM compiler which can generate c++ code ? ...

How can I add a description (-> description-colum in task manager) to my program (VS 2008, C++)

Hi, probably a pretty simple question, just couldn't find anything useful with Google. :( I have a simple unmanaged c++ project in Visual Studio 2008, and would like to add a description text. Right now I just see the name of the executable in task managers description column (processes tab), but I would like to provide my own text ther...

Generating preprocessed files using bcc32

Does anyone know what the command line option is to generated a preprocessed file using bcc32.exe (version 5.6.4)? I know that using gcc you can use -E to generate .i files. ...

How can I draw a patternBrush with transparent backround (GDI) ?

Hi, I can't draw a pattern with a transparent background. This is my snippet : bitmap.CreateBitmap(8, 8, 1, 1, &bits) brush.CreatePatternBrush(&bitmap) hbrush = pCgrCurrentDC->SelectObject(&brush); // set text color TextCol = pCgrCurrentDC->SetTextColor(CgrColourPalRGB); int oldBkgrdMode = pCgrCurrentDC->SetBkMode(TRANSPARENT); //dr...