c++

How do I intercept messages being sent to a window?

I want to intercept messages that are being sent to a window in a different process. What is the best way to do this? I can't see the messages when I use the WH_GETMESSAGE hook, and I'm not sure if I can subclass across processes? Any help would be much appreciated. ...

Which one to use c++ stl container or the MFC container?

For every stl container there is a MFC container available in visual c++.Which is better than the other one in what sense and what do you use? I always use STL container is that wrong? ...

GetShortPathName unpredictable results

GetShortPathName() is not working as I expect on XP SP3 http://msdn.microsoft.com/en-us/library/aa364989(VS.85).aspx Is returning the input string for paths like: C:\Test\LongFolderNameToTestWith\BinarySearch.ini exactly as sent? Yet: C:\Documents and Settings\LocalService\NTUSER.DAT Does make short names for the path, so I kn...

What's wrong with passing C++ iterator by reference?

I've written a few functions with a prototype like this: template <typename input_iterator> int parse_integer(input_iterator &begin, input_iterator end); The idea is that the caller would provide a range of characters, and the function would interpret the characters as an integer value and return it, leaving begin at one past the last...

AccessViolationException on calling the most basic c++ function I can think of from managed code

Hi all, I'm trying to learn how to use managed/unmanaged code interop, but I've hit a wall that 4 hours of googling wasn't able to get over. I put together 2 projects in visual studio, one creating a win32 exe, and one creating a windows forms .NET application. After a bunch of mucking around I got the C# code to call into the c++...

Why are C++0x rvalue reference not the default?

One of the cool new features of the upcoming C++ standard, C++0x, are "rvalue references." An rvalue reference is similar to an lvalue (normal) reference, except that it can be bound to a temporary value (normally, a temporary can only be bound to a const reference): void FunctionWithLValueRef(int& a) {...} void FunctionWithRValueRef(in...

Safe/flexible facade for Windows FormatMessage

I need to use FormatMessage() for a project, but I don't like its scary interface. Does anyone know of a facade that tidies it up while still allowing for the replacement parameters? I just read the second part of the FastFormat introduction, and am considering writing an extension for FormatMessage() (or asking the FastFormat project t...

C GUI, with a C++ backbone?

I have a simple (and also trivial) banking application that I wrote in C++. I'm on ubuntu so I'm using GNOME (GTK+). I was wondering if I could write all my GUI in C/GTK+ and then somehow link it to my C++ code. Is this even possible? Note: I don't want to use Qt or GTKmm, so please don't offer those as answers. ...

Good, free introductory text to c++?

Hi all, I'm looking for a good book on the basics of C++. I'm relatively new to writing compiled code, and the last time I've actually coded ANYTHING was 2 years ago...basic PHP stuff. Online resources are GREAT and I would prefer something that is legally available for free. Any ideas? -FO ...

How to integrate native applications with eclipse?

I have a couple of native applications written in C++ and C#. These are legacy applications that require data sharing between them. Currently, data sharing is through import/export of text file in some proprietary format. We are currently looking at integrating these two applications using eclipse. My questions are: How can we integrat...

Top 10 Frequencies in a Hash Table with Linked Lists

The code below will print me the highest frequency it can find in my hash table (of which is a bunch of linked lists) 10 times. I need my code to print the top 10 frequencies in my hash table. I do not know how to do this (code examples would be great, plain english logic/pseudocode is just as great). I create a temporary hashing list ...

How is STL iterator equality established?

I was wondering, how is equality (==) established for STL iterators? Is it a simple pointer comparison (and thus based on addresses) or something more fancy? If I have two iterators from two different list objects and I compare them, will the result always be false? What about if I compare a valid value with one that's out of range? I...

C-Style upcast and downcast involving private inheritance

Consider the following piece of code :- class A {}; class B : private A {}; B* bPtr1 = new B; // A* aPtr1 = bPtr1; // error // A* aPtr2 = static_cast<A*>(bPtr1); // error A* aPtr3 = (A*)bPtr1; B* bPtr2 = (B*)aPtr3; The C-style cast discards the private inheritance while both the implicit and static_cast fail (also dynamic_cast). Why...

C++ html forms

How do i get form data from HTML page using c++ ,as far as the basics of post and get? EIDT1: CGI using apache 2 on windows, i got c++ configured and tested with with apache already. ...

Calling a C++ Shared Lib within a C program...how to manage?

hi all, i'd like to write a wrapper for a C++ framework. this framework is kinda buggy and not really nice and in C++. so i'd like to be able to call their methods from outside (via good old C file) of their framework by using just one shared lib. this sounds like the need for a wrapper that encapsulates the wanted framework methods fo...

Winsock uncontrollably spawns several, persistent threads

I'm designing a networking framework which uses WSAEventSelect for asynchronous operations. I spawn one thread for every 64th socket due to the max 64 events per thread limitation, and everything works as expected except for one thing: Threads keep getting spawned uncontrollably by Winsock during connect and disconnect, threads that won...

Memory Based Data Server for local IPC

I am going to be running an app(s) that require about 200MB of market data each time it runs. This is trivial amount of data to store in memory these days, so for speed thats what i want to do. Over the course of a days session I will probably run, re-run, re-write and re-run etc etc one or more applications over and over. SO, the ques...

Is there a way to automatically make a library either static or dynamic?

I know this might be a long shot, but here it goes. I have several active projects and each has sub project library which gets compiled when the main project compiles. These libraries are dynamic ones, but recently there was an issue that might arise a need for those libraries (most of them are shared between projects) to be static inste...

Is there a function that returns the ASCII value of a character? (C++)

I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc... On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers? ...

Is there a way to enable both Objective-C mode and C++-mode at the same time in emacs?

I'm working with some Objective-C++ code (.mm files), and I'm curious if it's possible to get emacs to use proper syntax highlighting for both the Objective-C parts and the C++ parts. objc-mode and c++-mode are both major modes (built on top of cc-mode), so they can't be used at the same time. Are there any minor modes or elisp hacks a...