c++

Access Cocoa and/or Carbon to automatically start on boot on OS X (on C++ also using QT)

I have a C++ application using the QT framework. I'm trying to add an option for the user to be able to set the program to start automatically on startup. My development machine is running OS X 10.6. As my main Mac reference, I'm using this Apple documentation. According to the documentation, there are two recommended ways of doing thi...

Can I default a function argument to the value of __FILE__ at the caller?

In C++, can I have a defaulted argument to a function which defaults to __PRETTY_FUNCTION__, __FILE__, and __LINE__ as defined at the point of the caller and not the point the defaults are supplied in a header file without using macros? ...

How can I build VS 2010's C Runtime Library?

I need to modify the C runtime which ships with VS2010 because the 2010 CRT relies on functions released in Windows XP SP2, and I need to be able to deploy to Windows 2000. Specifically, I need to remove any and all calls to EncodePointer and DecodePointer. The source for the C runtime is included in C:\Program Files (x86)\Microsoft Vi...

C++/STL - Program crashes when accessing class pointer instance in a std::map

Okay, I have a function which reads a xml file and creates controls using new and stores them in public member variables of a class called Window: std::map<const char*, Button*> Buttons; std::map<const char*, TextBox*> TextBoxes; std::map<const char*, CheckBox*> CheckBoxes; The Button, TextBox and CheckBox classes are homemade wrapper...

Algorithm for edge intersection?

Given Polygon P which I have its verticies in order. and I have a rectangle R with 4 verticies how could I do this: If any edge of P (line between adjacent vertexes) intersects an edge of R, then return TRUE, otherwise return FALSE. Thanks * * * * ...

Linked list problems

Possible Duplicate: Copy a linked list Hello stackoverflow! I am trying to learn more about linked lists so I am trying to create a function that deep copies a linked list. I've got this under control. The hard part is that the input list is going to contain nodes that reference other random nodes within the list. First probl...

C++ different -> and "."

Possible Duplicate: what is the difference between (.) dot operator and (->) arrow in c++ I'm trying to learn c++, but what I don't understand is the different between "->" and "." when calling a method. For example, I have seen something like class->method(), and class.method(). Thanks. ...

Operator precedence for "<<" and "++" in VS2008 with optimization

I'm stuck with a weird VS2008 C++ issue, that looks like operator precedence is not respected. My question is what is the output of this: int i = 0; std::cout << ((i != 0) ? "Not zero " : "zero ") << ++i << std::endl; Normally the ++ has precedence over the <<, right? Or is the << considered like a function call giving it a hi...

Hex editing with C++

Let's assume I want to change something in the 000F5344 address of an executable. How do I do it? ...

Sqlite undefined reference to `sqlite3_open' error in Netbeans C++ on Ubuntu, Integrating SQLite into Netbeans C++ Ubuntu

Hi! I am trying to use Sqlite in my Netbeans C++ and following the tutorial here http://www.dreamincode.net/forums/topic/122300-sqlite-in-c/ When i build it,its giving me undefined reference to `sqlite3_open' and the other sqlite3 functions. I included the sqlite3.h too. What am i missing here? When i added the linker to static libr...

How to set background color of window after I have registered it?

I am not using a dialog, im using my own custom class which i have registered and then used the CreateWindow call to create it, i have preset the background color to red when registering: WNDCLASSEX wc; wc.hbrBackground = CreateSolidBrush(RGB(255, 0, 0)); but now i want to change the background color at runtime, by e.g. clicking a...

Determine input from different devices

My PC has two devices working like keyboard, the normal keyboard and a HID (Human Interface Device) input device (it's a remote control). I want separate the input from keyboard and from remote, capturing only the remote control. How can I write a program in C/C++ to do this task? It's not a easy task because this program is operating ...

Threading newbie with issue with runaway threads...

Ok, to you understand I will explain the problem: I am using a library called ClanLIB (not my choice), that library, SEEMLY (I am not certain, even reading the sourcE), creates a thread that handles sound. This thread, when the buffer is empty, tries to fetch more data, usually this cause a underrun when the data generating library is t...

C++/Win32 API - SetFocus to button does not work

HWND button = CreateWindowEx(0, "BUTTON", ...); SetFocus(button); // Button no get focus! :( Also, I have other controls on my form that I am able to SetFocus() to. Thanks, Martin ...

When should we use method overloading vs method with different naming

Sometimes, I felt method overloading may create confusion. class a { public: void copy(float f); void copy(double d); }; a me; me.copy(1.2); // Not obvious at the first sight on which version we are calling. A workaround on this is. class a { public: void copyFloat(float f); void copyDouble(double d); }; How...

PostThreadMessage sets GetLastError to 1444

In PostThreadMessage my thread ID is correct, but I am getting the error 1444 ("Invalid thread identifier. "). Anyone know how to fix it? ...

pinch to zoom on windows mobile 6

Need to develop pinch-in pinch-out effect on HTC-HD2 with OS windows mobile 6.5. Is windows mobile 6.5 support this feature? If so can anyone provide me exposed APIs or sample code or any good links for doing it? So far I have implemented UI related stuff(zoom in-out using buttons etc) in C# .net using Windows Mobiles 6.5 Gestures. I am...

bind two arguments

Consider I have the following struct: struct IDirect3D { IDirect3D() : ref_count_(0) {} unsigned long Release() { return --ref_count_; } private: long ref_count_; ~IDirect3D() {} }; I want to use shared_ptr to it like in the followed code (minimal example): int main() { boost::shared_ptr<IDirect3D> ptr; IDire...

Initializing C++ const fields after the constructor

I want to create an immutable data structure which, say, can be initialized from a file. class Image { public: const int width,height; Image(const char *filename) { MetaData md((readDataFromFile(filename))); width = md.width(); // Error! width is const height = md.height(); // Error! height is const } }; Wha...

Linking Errors trying CS106B

I attempted to start a blank VS2008 project and follow along with the things being typed during the lectures, but I ran into a horrendous bunch of link errors. In the zip file for assignment 1 for the PC, there is a folder called CS106B. First I told the compiler where the header files are (they're in the CS106B folder). Next I had to t...