c++

what are LPARAM and WPARAM defined as

I know I'm being lazy here and I should trawl the header files for myself, but what are the actual types for LPARAM and WPARAM parameters? Are they pointers, or four byte ints? I'm doing some C# interop code and want to be sure I get it working on x64 systems. ...

launch agent from daemon in user context

I have a launch daemon that runs in the login context of a Mac OSX 10.6 machine. I want to launch an agent for each user from that agent, and have the agent run in the user's login context. However, I need to control the precise arguments to the agent application very carefully, which is why I cannot use a launchd agent, like I have for ...

Read in double type from txt file - C++

Hi there I'm in the midst of a university project and have decided to implement a method that can accept information from a text file (in this instance called "locations.txt"). input from the text file will look like this: London 345 456 Madrid 234 345 Beinjing 345 456 Frankfurt 456 567 The function looks like this currently (and you...

Use of iterators over array indices.

Hello all, I just wanted to know what is the main advantage of using the iterators over the array indices. I have googled but i am not getting the right answer. ...

Handling Complex Rules in in GUI applciations (C++ or C#)

Im working on a dialog box in which several rules must be satisfied before the OK button is enabled. Currently any action on the page such as entering data or selecting an item from a drop down list (amongst other things) calls a single function called ProcessEvent() - this function handles all logic and either enables or disables the O...

avoiding enums as interface identifiers c++ OOP

Hi I'm working on a plugin framework using dynamic loaded shared libraries which is based on Eclipse's (and probally other's) extension-point model. All plugins share similar properties (name, id, version etc) and each plugin could in theory satisfy any extension-point. The actual plugin (ie Dll) handling is managed by another library, ...

What is the point of STL?

I've been programming c++ for about a year now and when i'm looking about i see lots of references to STL. Can some one please tell me what it does? and the advantages and disadvantageous of it? also what does it give me over the borlands VCL or MFC? thanks ...

Using time facets on universal_time

Hi all, on boost, to create a time facet to format an specified time we use the folowing: boost::local_time::local_time_facet* facet = new boost::local_time::local_time_facet("%Y%m%d %H:%M:%S.%f"); std::stringstream date_stream; date_stream.imbue(std::locale(date_stream.getloc(), facet)); date_stream << boost::local_time::local_microse...

How to make #include <mysql.h> work?

I'm building an open source project from source, and it need to include <mysql.h>: #if USE_MYSQL #include <mysql.h> #endif and the compilor reports: mysql.h no such file or directory MySQL is yet another greater open source project,what do I need to do to make it work? ...

Caller graph for overloaded operators in Visual Studio 2005

Is is possible to get a callers graph for overloaded operators? I have a simple struct with a natural ordering which I have represented by overloading the relational operators. Looking back through the code, it appears that I made a mistake in defining operator >. I had set the greater than to simply return the negation of operator < (t...

How can I find out how much memory is physically installed in Windows?

I need to log information about how much RAM the user has. My first approach was to use GlobalMemoryStatusEx but that only gives me how much memory is available to windows, not how much is installed. I found this function GetPhysicallyInstalledSystemMemory but its only Vista and later. I need this to work on XP. Is there a fairly simple ...

What's the relationship between header files and library files in c++?

Why do we need to add both includes and libs to the compilation? Why doesn't the libs wrap everything in it? ...

C++ open source projects

Hello, I'm looking for a suitable open source project to work on in C++. It really can be anything. My background is in gaming, on both PC and consoles; but I'd prefer to work on something low latency or real time. I'm also interested in Math stuff. Do any of you guys have suggestions? ...

Visual Studio Recompiles Project Every Time I Try to Run it

Hello, I have a Visual Studio 2005 solution. Every time I try to run the startup project (C++), the project gets build again, although I did not make any change. How can I get the normal, sane behaviour, where projects get built only when needed? How can I debug the problem further? Thanks, ...

Cannot initialize non-const reference from convertible type

Hi, I cannot initialize a non-const reference to type T1 from a convertible type T2. However, I can with a const reference. long l; const long long &const_ref = l; // fine long long &ref = l; // error: invalid initialization of reference of // type 'long long int&' from expression of type ...

RTP H.264 save and replay

We are interested in saving a H.264 stream and replaying it. Is there any one who experience saving h.264 using winpcap and replaying it. We were able to save H.263 and replay, but same logic does not work for H.264. We also tried rtpdump tool to save H264 stream, but we were unable to replay it in that format? thanks in advance ...

struct method linking

I'm updating some old code that has several POD structs that were getting zero'd out by memset (don't blame me...I didn't write this part). Part of the update changed some of them to classes that use private internal pointers that are now getting wiped out by the memset. So I added a [non-virtual] reset() method to the various structs a...

Presenting MVC to Old C++ Spaghetti Coders?

I wish to present the idea of MVC to a bunch of old C++ spaghetti coders (at my local computer club). One of them that has alot of influence on the rest of the group seems to finally be getting the idea of encapsulation (largely due in part to this website). I was hoping that I could also point him in the right direction by showing...

Help writing a complex macro

Hi all, I am working with a unit-testing suite that hijacks function calls and tests expected output values. The normal layout requires one block of unit-testing code for each expected value. Since my code makes use of a large number of enums, I would like to automate the automated-testing with some for loop / macro magic, and I'm look...

C++ using this pointer in constructors

In c++, during a class constructor, I started a new thread with 'this' pointer as a parameter which will be used in the thread extensively (say, calling member functions). Is that a bad thing to do? Why and what are the consequences? Edit: my thread start process is at the end of the constructor. Thanks, Gil. ...