c++

What's the correct way to get a gradient in a toolbar in win32 API (no MFC)?

For example, Notepad++ has a toolbar that looks like this: http://yfrog.com/58npptbp 7-Zip has a toolbar that looks like this: (stack overflow won't let me post more links because I'm new) Whereas mine is boring and flat, like this: (stack overflow won't let me post more links because I'm new) How do I do make my toolbar 3d? Is the...

array as const pointer

Hi. consider the following code: void Increment(int *arr) { arr++; } int main() { int arr[] = {1,2,3,4,5}; // arr++ // illegal because its a const pointer Increment(arr); // legal } My question is if arr is a const pointer, how come i can send it to a function that doesn't receive a const pointer? The code compile...

boost threadpool

I'm trying to create a threadpool with the boost threadpool library, but on defining it I keep getting lots of error about template params being wrong. I'm probably doing something fundamentally wrong, but I'm not seeing it? //Threadpool typedef boost::threadpool::thread_pool< boost::threadpool::task_func, boost::threadpool::fi...

Tracking down the source code line of a crash from a non-debug built module

Hi I have a widows crash-dump with a call stack showing me the module!functionname+offset of the function that caused the crash. The module is built without debug information using gcc. The cause of the crash is an exception caused by a failed to write at a given address, i.e access violation(05), write violation(01) On my development...

Learning Linux from Windows Newbie questions

I am a newbie in linux and programming. I want to learn linux command and use create some C and C++ programme to interact with the linux API from my windows XP. However, I am not sure how to set up the environment from my windows based computer. What programme should I install? Also, it seems like linux has Ubuntu, Fedora. I heard of Re...

Where to get compiled version of gccxml on windows?

Can anyone point to a place where I can get a compiled version of gccxml on windows? ...

Vector push_back Access Violation

This is probably a silly error, but it's driving me nuts trying to fix it. I have a struct: struct MarkerData { int pattId; unsigned short boneId; Ogre::Matrix4 transToBone; Ogre::Vector3 translation; Ogre::Quaternion orientation; MarkerData(int p_id, unsigned short b_id, Ogre::Matrix4 trans) { pattId = p_id; boneId = b_i...

How to make a C++ EXE larger (artificially)

I want to make a dummy Win32 EXE file that is much larger than it should be. So by default a boiler plate Win32 EXE file is 80 KB. I want a 5 MB one for testing some other utilities. The first idea is to add a resource, but as it turns out embedded resources are not the same as 5 MB of code when it comes to memory allocation. I am think...

Using C++ libraries

Hi whole of our project development is in C. However there are alot of string operations here and there and how much care we make .. we endup having coding errors in string operations and this results most of the time in for buffer overflows ..stack corruptions etc. due to programmers fault. How nice is this idea to just use C++ strin...

Assembly Code in C++

I would like to learn reading the assembly code generated by the compiler. Where and how could I assess the assembly code generated from C++ ? Thanks ...

What is the purpose of ostringstream's string constructor?

On MSVC 2005, I have the following code. std::ostringstream stream("initial string "); stream << 5; std::cout << stream.str(); What I expect is: initial string 5 What I get is: 5nitial string Initializing the stream with a string, I would expect the stream to move its position to the end of the initial string. Obviously, STL doe...

std::map::erase infinite loop

I have a map of a vector of char's and a vector of strings. Every so often, if I've seen the vector of characters before, I'd like to add a string to my vector of strings. Below is my code to do that. map<vector<char>, vector<string>>::iterator myIter = mMyMap.find(vChars); if(myIter != mMyMap.end()) { vector<string> vStrings = my...

OpenGL: glLogicOp() color filling trick with different coloring?

I am currently using glLogicOp() with a cube, which i render twice: with glFrontFace(GL_CW) and then with glFrontFace(GL_CCW). This allows me to see which area of the other 3d object my cube is overlapping with. But i want to change the negative color to something else, lets say 0.5f transparent blue color. How this can be done? Sorry ...

Tool to extract theme parts

I'm looking for a tool to extract the theme parts and save them as pngs. By this I mean, Pushbutton, Start orb, etc. I found an application that can display the theme parts but I cannot save them into a format with an alpha channel. Thanks ...

C++ singleton vs completely static object

Let say we need to have just one instance of some class in our project. There are couple ways of doing it. I want to compare. Please can you review my understanding. 1) Classical Singleton pattern 2) Completely static class (all methods and members are static). As I understand the differences are following: a) The order of initiali...

Keyboard repeat count

Hello i am having trouble utilising the repeat count parameter of the msg WM_KEYDOWN ... using visual c++ 2008 for some reason or the other the repeat count of the msg does not increment if the key is held for long.... for eg if i use this code:: ---------- *TextOut(hdc,cxChar*2*(sizeof(szBuffer)/sizeof(TCHAR)),i*cyChar,szBuffer,wspri...

Condensing Declaration and Implementation into an HPP file.

I've read a few of the articles about the need / applicability / practicality of keeping headers around in C++ but I can't seem to find anywhere a solid reason why / when the above should or should not be done. I'm aware that boost uses .hpp files to deliver template functions to end users without the need for an associated .cpp file, a...

Copying a C++ class with a member variable of reference type

I've a class which stores a reference to its parent, the reference is passed in the constructor. If I try to copy an instance I get an error "error C2582: 'operator =' function is unavailable" presumably down to the reference being non-assignable. Is there a way around this, or do I just change the variable to pointer instead of referen...

Defining constructor for struct declared inside a class in c++

Hi all. Can any one tell me how to declare constructor for a struct? My struct is delared in the private part of a class and I want to declare my constructor for it. Below is my code class Datastructure { private: struct Ship { std::string s_class; std::string name; unsigned int l...

Getting the index of boost::fusion::vector from a boost::mpl::vector

Hi, I started to play around with the boost fusion and mpl library and got stuck with a quite simple problem. I declared the following types: typedef boost::mpl::vector<char, int, long> TypeVector; typedef boost::fusion::vector<char, int, long> FusionVector_t; Now I wanted to write a function that gets me the value from the Fusion...