c++

PostMessage for cross application messages.

I'm trying to send a keystroke to another application. I can successfully find the window handle since using SendMessage worked exactly as intended. However, when I switched the SendMessage over to PostMessage, the application no longer received the messages. I did, however, find a workaround by using HWND_BROADCAST as the window handl...

Protected data in parent class not available in child class?

Hi, I am confused: I thought protected data was read/writable by the children of a given class in C++. The below snippet fails to compile in MS Compiler class A { protected: int data; }; class B : public A { public: B(A &a) { data = a.data; } }; int main() { A a; B b = a; return 0; } Error Message: Microsoft ...

How to create a rounded window in Ubuntu?

How to create a rounded window in Ubuntu? Lang: C++ For example like the tipper plugin from Miranda. ...

DirectX Device CAPS

I read the following in the DirectX 10 documentation: "Legacy hardware capability bits (caps) have been removed in favor of a rich set of guaranteed functionality, which targets Direct3D 10-class hardware (minimum)." "Removal of CAPS bits - Direct3D 10's base feature set is guaranteed." Where do I find a list of the "guaranteed functi...

Using GCC's C++0x mode in production?

Is anyone using the GCC 4.4.0 C++0x support in production? I'm thinking about using it with the latest MinGW, but I'm not sure if it's mature enough. I'm interested in: TR1 support auto initializer lists ...

DoEvents equivalent for C++?

I'm new to native c++. Right now, I made it so when I press the left mouse button, it has a for loop that does InvalidateRect and draws a rectangle, and increments X by the box size each time it iterates. But, C++ is so much faster and efficient at drawing than C# that, it draws all this instantly. What I would like is for it to invalida...

Use arrow keys c++?

I'm new to c++ and I'm not sure how WM_KEYDOWN works. I want to have a case for each arrow key (UP,DOWN,LEFT,RIGHT) Thanks ...

How do I successfully use VIM as an external editor for Code::Blocks?

Hi, I really like Code::Blocks for its build system and step through debugging abilities - ie I really enjoy using wrappers to gcc/gdb more than using them from Makefiles or the command line. The problem is, I'm so brain damaged (or spoilt, some might say) by years of VIM use that I cannot edit in a standard Windows text editor. So, I ...

C++ class dependencies

Hi everyone! I'm having some problems with my class because they both depends on each other, to one can't be declared without the other one being declared. class block: GtkEventBox { public: block(board board,guint x,guint y): image("block.png") { this.board = board; this.x = x; this.y =...

using #include to load opencl code

i've seen this done long ago with hlsl/glsl shader code. using a #include on the source code file that pastes the code into a char* so that no file io happens at runtime. if i were to represent it as pseudo-code it would look a little like this: #define CLSourceToString(filename) " #include "filename" " const char* kernel = CLSourceToS...

String table encoding vs. gzip compression

In my application, I need to store and transmit data that contains many repeating string values (think entity names in an XML document). I have two proposed solutions: A) create a string table to be stored along the document, and then use index references (using multi-byte encoding) in the document body, or B) simply compress the do...

C++ Custom compare function for list::sort

Hi I'm having trouble compiling a simple piece of code. I am creating a class which implements a Deck of cards, and I want to create a shuffle method using the list::short method. Relevant code: deck.h #ifndef _DECK_H #define _DECK_H #include <list> #include <ostream> #include "Card.h" #include "RandomGenerator.h" using namespace s...

Simple Qt Application won't compile on OS X

I've downloaded the Qt SDK and am trying to get started on my first Qt application using Qt Creator. Using the wizard from the opening splash screen I selected "Qt4 Gui Application" and it threw together a little project for me. When I try to build that project (without making any changes) I get build errors: Running build steps for ...

Array of const char*

I'm writing a C++ program that uses the RRD libraries that require an array of 'const char*' for their functions. I thought I could just declare the array, and then initialize each element of the array, but changing one, changes all of them. Obviously I'm missing something. Here's an example similar to the code I am writing (i.e. it exhi...

Problem solving in C++ with STL

I am preparing for a programming competition in witch we solve programming problems in c++. Looking at the former year solutions, they seem quite easy (not more than ~30 lines of code). I realised that they are widely using the STL for easy manipulating - vectors, sets, maps, lists and also the algorithms available in STL. Any site fo...

How to read and write bits to a byte array

I have a unsigned char buffer, and I'm wondering how I would write and read signed and unsigned bits to this byte buffer. In the Source Engine there is a class named bf_write, which two main methods (used by WriteString, WriteChar, WriteLong, etc.) use two functions named WriteUBitLong and WriteSBitLong. Thanks in advance ...

Why are C++ inheritance mechanisms opaque?

Why, for example, is there no language support to examine a vtable? Why can't I replace a member function with a new one? I have a gut feeling that there are ways to put such features to good use. Are there any other languages out there which allow me to do such things? ...

Sleep() becomes less accurate after replacing a PC? (C++)

I have a program that was built in C++ (MFC, Visual Studio 6.0) several years ago and has been running on a certain Windows machine for quite some time (more than 5 years). The PC was replaced a month ago (the old one died), and since then the program's timing behavior changed. I need help understanding why. The main functionality of th...

Get year from boost ptime

Hi, This is my first post on stackoverflow. First of all I'd like to say thanks for this site! It has provided many excellent answers to questions I've had in the past few months. I'm still learning C++, coming from vb6. I'm converting an existing program to C++ and here need to manipulate Sybase timestamps. These timestamps contain dat...

Drawing issues with c++

I'm sort of new to c++ and i'm trying to create a game. I have a 2d array RECT_GRID of rectangles. I have a 2d array GRID of unsigned short. I fill the rectangle array during WM_CREATE The WM_PAINT event paints rectangles for all the elements in the array. The color of the rectangle is based on the value of GRID[x][y] I made it so when...