c++

not active popup window

Hi, I've created a popup window with SW_SHOWNA. The problem is when I move the main window behind the popup window the popup window stays at the same place. Is there any way to catch the click on the title bar (or other technique) of the main window behind the popup window and to close the popup window? thanks a lot! mike. ...

How to display a non-modal CDialog?

Can someone say me how I could do a No Modal Dialog in MFC's Visual c++ 6.0 for show it? I wrote this, CDialog dialog; if (dialog.init(initialization values...)) dialog.DoModal(); But it blocks my application for show the dialog. I dont know if exists any method or other way to do. Thanks ...

Correct BOOST_FOREACH usage?

When using BOOST_FOREACH, is the following code safe? BOOST_FOREACH (const std::string& str, getStrings()) { ... } ... std::vector<std::string> getStrings() { std::vector<std::string> strings; strings.push_back("Foo"); ... return strings; } Or should I grab a copy of the container before calling BOOST_FOREACH, e.g.: cons...

Recursive functions in C/C++

If we consider recursive function in C/C++, are they useful in any way? Where exactly they are used mostly? Are there any advantages in terms of memory by using recursive functions? Edit: is the recursion better or using a while loop? ...

safe reading from a stream in a for loop using getline

Hi I want to read from a stream using std::getline inside a for loop. The stream I mean is a class inherited from the std::basic_iostream. std::string line; for(;;){ try{ std::getline( myStreamObj, line ); if( line != "" ){ std::cout << line << std::endl; } } ca...

undefined referance to LibSerial

So i'm writing a serial transmision program, and have just changed over to using C++, it been a while since I used C++ (I've been working with C recently, and before that java) Now I need to use LibSerial, (it seems much simpler to use than C's termios) my code is: //gen1.cpp #include "string2num.h" // a custom header #include <iostr...

how to capture mouse cursor in screen grab?

Hi, I'm using OpenGL to grab the contents of the Mac OSX screen - thsi works very well, except it does not grab the mouse cursor graphic. I need to somewhow get that cursor graphic, either as part of my screen capture routine, or separately. My question is either: How can I ensure that the mouse cursor image is included with the Open...

Best C++ Linux IDE

Possible Duplicate: Best unix/linux C++ debuger/IDE ? Hey, I've been searcing and reading about a good Linux C++ IDE, and couldn't set my mind on the right one. I've been using Eclipse with the C++ pluging , for C development, for the last couple months, but I found it not very useful, especially the debugging process that ...

which stl container I should choose If I need to random get an item from the container

Just As title . As least I know array might not be one I want . cus I need to generate a random index before I want to randomly pick up one item from the array . For your opinion. I've change the title of my question to "which stl container I should choose If I need to random get an item from the container" . what I really find is a cot...

How do I ensure no re-entrant access to my main-STA COM server (C++)?

OK, I suspect I'm going to have difficulty even putting this in words since my understanding of COM and apartments isn't really up to the job ;-) I have a COM in-process server/component (C++) that wraps some legacy code. Due to the limitations of this legacy code I need to ensure that the methods of the COM component are: only called...

Private/public header example?

Can someone please give me an example of how public and private headers work? I have done some reading on the net but I can't seem to find much useful information with sample codes. I was advised that I should use private headers to separate the public and private parts of my code for creating a static library. After some reading I have ...

looking up c++ documentation inside of vim

I code c++, using vim. Often times, I find myself wasting time (and brekaing flow) looking up trivial things like: is std::string.substring does it take (start, length) or (start, end). This often results in open browser; waid; seach on google; first link useless, try second link; okay, done. How do others do this in vim? Is there a ...

Ellipsis do not work for static text in ATL project

Hey folks, I am currently working on an ATL project with a simple UI. In this UI I have a couple of static text controls and I want them to have ellipsis at the end when the text is to long. So I set the word ellipsis property in the designer to true (which also triggers end ellipsis and path ellipsis to true). However during run-time t...

vim omnicomplete vs. vim intellisense

Are Vim OmniComplete and Vim Intellisense mutually exclusive or complimentary? I'm a bit confused by conflicting terminology and implementations, such as these C++ OmniComplete and C++ Intellisence plugins. ...

How to detect if HPET is available

Hi, how can I detect (using C++) wether my system has a HPET or not? Thx for your help, Tobias HPET = High Precision Event Timer ...

C++ Is private really private?

I was trying out the validity of private access specifier in C++. Here goes: Interface: // class_A.h class A { public: void printX(); private: void actualPrintX(); int x; }; Implementation: // class_A.cpp void A::printX() { actualPrintX(); } void A::actualPrintX() { std::cout << x: } I built this in to a stat...

Compile for x64 with Visual Studio ?

Question: Assume a C++ hello world program, non .NET. With Visual Studio 2005/2008/2010, how can I compile a 64-Bit application ? I have a 64 Bit Windows, but by default, VS seems to compile 32 bit executables... On Linux with g++, I can use -m32 and -m64, but how can I compile a 64 bit solution with Windows ? Is it even possible with ...

Why is the delete operator required to be static?

I found this one question asking the same thing, however only the 'new' part was answered, so here goes again. Why is the delete operator required to be static? Somehow it doesn't make sense. The new operator makes perfect sense, just like the constructor can't be virtual, neither can the new operator. However, the destructor can (and s...

Extracting 'parts' of a hexadecimal number

I want to write a function getColor() that allows me to extract parts of a hexadecimal number entered as a long The details are as follows: //prototype and declarations enum Color { Red, Blue, Green }; int getColor(const long hexvalue, enum Color); //definition (pseudocode) int getColor(const long hexvalue, enum Color) { switch (C...

pass by reference c++

My teacher in c++ told me that call by reference should only be used if I'm not going to change anything on the arrays inside the function. I have some really big vectors that I'm passing around in my program. All the vectors will be modified inside the functions. My matrices are of sizes about [256*256][256][50]... Is there some partic...