c++

Get window handle on which mouse button was clicked

Hey, I'm using Windows Hook, I installed the mouse hook, system-wide and its working perfectly. Now there is a problem, I need to the get window handle on which the mouse was clicked.. How do I do that? Does the Mouse hook event passes us that information? ...

Storing data of unknown size in C++

Hi, I've been using PHP for about 4 years, however I've come across a problem that requires something with slightly (:P) better performance and so I've chosen C++. The program I'm writing is a Linux daemon that will scan a MySql database for URL's to load, load them using cURL, search for a specified string, and then update the databas...

Building Qt 4.5 with Visual C++ 2010

Did somebody tried to build Qt 4.5 with Visual Studio 2010 (Beta 2)? Any hints on doing that successfuly? Later edit I tried to run configure from a Visual Studio 2010 console. There is no makespecs support for 2010, so configure fails because of that. ...

Connecting multiple devices through RAPI2

The Microsoft RAPI2 interface is designed with the ability to talk to multiple devices. But, ActiveSync 4.5.0 allows only allows one device at a time to connect and only allows it over a USB connection. Is there a way to write a client-server piece for the desktop and mobile device that will allow more than one device to connect to the...

C# call to unmanaged C++ returning string of squares symbols

I have some C# code calling into an unmanaged C++ DLL. The method I am calling is intended to accept a string as a ref. To handle this I pass in a StringBuilder, otherwise there is a StackOverflowException. This is working fine, but on some calls the string that comes back from the unmanaged code is a jumbled string like this: øŸE˜.,Ê...

emacs completions or IntelliSense the same as on Visual Studio

emacs 22.2.1 on Linux I am doing some C/C++ programming using emacs. I am wondering does emacs support completions (IntelliSense in Visual Studio). For example when filling structures I would like to see the list of members when I type the dot operator or arrow operator. The same would go for function signatures that give me the types...

Firing a COM Event From Another Thread

I have created an in-process COM object (DLL) using ATL. Note that this is an object and not a control (so has no window or user-interface.) My problem is that I am trying to fire an event from a second thread and I am getting a 'Catastrophic failure' (0x8000FFFF). If I fire the event from my main thread, then I don't get the error. ...

CPython is bytecode interpreter?

I don't really get the concept of "bytecode interpreter" in the context of CPython. Can someone shed some light over the whole picture? Does it mean that CPython will compile and execute pyc file (bytecode file?). Then what compile py file to pyc file? And how is Jython different from CPython (except they are implemented in different la...

CppUnit leakage

Hi all, running my regression tests with valgrind I have this kind of report: ==20341== 256 bytes in 1 blocks are indirectly lost in loss record 915 of 919 ==20341== at 0x4A0661C: operator new(unsigned long) (vg_replace_malloc.c:...

C++ Variable Conversion

I need to pass one of my parameters to a write() function. It is asking for a type of 'const void*' I am a PHP guy and don't know C++ very well. Here is my parameter: const fmx::Text& distance = dataVect.AtAsText(3); I don't know of any other way to pull in that field. I would love to just declare it const void* but I don't know how...

OpenCV Multi-Threaded Thread Message

I am writing a program using .Net 3.5 and OpenCV 1.1. I have multiple threads that need to get an image variables from the web camera on my computer, the problem being I get memory violation errors when multiple threads try to access the camera at the same time. I know I can use PostThreadMessage and GetMessage to send a variable to the ...

Help me evaluate this casting

I found this in the PowerVR mesh drawing code and I don't really know how to read it. &((unsigned short*)0)[3 * mesh.sBoneBatches.pnBatchOffset[batchNum]] What is going on here? Is this a reference to void cast as an unsigned short pointer and then offset by (3*mesh(etc...) + batchNum)? It's breaking my brain. It's found in the con...

Is it a good practice to always create a .cpp for each .h in a C++ project ?

Some classes, like exceptions or templates, only need the header file (.h), often there is no .cpp related to them. I have seen some projects were (for some classes) there aren't any .cpp files associated to the headers files, perhaps because the implementation is so short that it is done directly in the .h, or maybe for other reasons,...

non-blocking thread-safe queue in C++?

Is there a thread-safe, non-blocking queue class in the C++? Probably a basic question but I haven't been doing C++ for a long time... EDIT: removed STL requirement. ...

C++ Boost: is it included by default in most Linux distros?

Is the C++ Boost library usually included by default on most Linux distros? ...

std::map, references, pointers and memory allocation

I am having a lil hard time with map and the valuetype allocation. consider this simple class: class Column { private: char *m_Name; public: // Overrides const char *Name(){ return this->m_Name; } // Ctors Column(const char *NewName){ this->m_Name = new char[strlen(NewName) + 1]; strcpy(this->m_N...

Is there a standalone C++ source preprocessor?

Is there a standalone C++ preprocessor? I don't need the compiler/linker, and I'm not able to install a full kit. I'd like to be able to obtain preprocessed version of some headers, using some defines and include paths I provide. EDIT: I can't rely on anything being available. No cl, no gcc, nothing. The least I would need done is some...

How to get a variable address using a string with variables name?

I would like to do something like a simple and quick general console debugger. This small lib should be embedded to the main program. So I would like to do stuff like this while running the program in console mode: "input: print i" "output: 15.53" "input: set color 255" "input: print color" "output: 255" And both "i" and "color" wo...

Does the declaration or definition determine the scope of a variable in C/C++?

Which determines the scope of a variable, the declaration or definition? ...

Inserting objects into hash table (C++)

This is my first time making a hash table. I'm trying to associate strings (the keys) with pointers to objects (the data) of class Strain. // Simulation.h #include <ext/hash_map> using namespace __gnu_cxx; struct eqstr { bool operator()(const char * s1, const char * s2) const { return strcmp(s1, s2) == 0; } }; ... hash_map< co...