c++

How to controll (and emulate) monitor/projector on Linux?

I would like to write some C/C++ program to take controll over monitor/projector attached to my computer. What I want is to generate arbitrary output on it and I want that only my application can draw on that screen. I've googled around, but I couldn't find almost anything that would lead me in some direction. Do you know where I can le...

How to install MinGW Correctly on Windows

Hello all, I have recently started learning C++ but I require a compiler. I have tried the one packaged with Code::Blocks but I have been told it is out of date. I have tried reading the instructions on the website but I simply don't know which files to download and un-zip. Does anyone know of a list of files to download? (latest version...

How does the compile choose which template function to call?

Regarding the below code, how does the compiler choose which template function to call? If the const T& function is omitted, the T& function is always called. If the T& function is omitted, the const T& function is always called. If both are included, the results are as below. #include <iostream> #include <typeinfo> template <typename ...

Access violation reading location 0x00184000.

having troubles with the following line HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mVB)); it appears the CreateBuffer method is having troubles reading &mVB. mVB is defined in box.h and looks like this ID3D10Buffer* mVB; Below is the code it its entirety. this is all files that mVB is in. //Box.cpp #include "Box.h" #include "V...

WM_KEYDOWN confusion

I'm trying to get my application to do something when CTRL+S is pressed. I'm just not sure how the W and L params work for WM_KEYDOWN. MSDN has something about bit fields which i'm not sure about. How can I detect CTRL and S? Thanks What do I do if another control aside from hWnd has focus? ...

Boost's "cstdint" Usage

Boost's C99 stdint implementation is awfully handy. One thing bugs me, though. They dump all of their typedefs into the boost namespace. This leaves me with three choices when using this facility: Use "using namespace boost" Use "using boost::[u]<type><width>_t" Explicitly refer to the target type with the boost:: prefix; e.g., boost::...

Creating a 3d plane using Frank Luna's technique: what are sinf and cosf?

I am creating a 3d plane that lies on the x and z axis, and has hills that extend on the y axis. The bulk of the code looks like this: float PeaksAndValleys::getHeight(float x, float z)const { return 0.3f*( z*sinf(0.1f*x) + x*cosf(0.1f*z) ); } void PeaksAndValleys::init(ID3D10Device* device, DWORD m, DWORD n, float dx) { md3dD...

WxWidgets custom events

Hello, I'm trying to use a custom event in my WxWidgets C++ application, like described here. In the constructor of my wxApp: Connect(wxID_ANY, wxCommandEventHandler(APP::OnMyEvent)); Then the function that should catch the event: void APP::OnMyEvent(wxCommandEvent& event) { exit(0); //testing } Finally, to test it: wxComman...

C++ String manipulation isn't making sense to me...

This particular assignment has to do with removing substrings from strings; I am trying some of the Stanford SEE courses online to learn some new languages. What I've got so far is below, but if text = "hello hello" and remove ="el", it gets stuck in a loop, but if i change text to text = "hello hllo", it works, making me think I'm doi...

How do I define an Icon in QT with a compile time predefined image?

I have a png file on disk at compile time. I'd like to have it included into the compiled executable. How do I define such an icon in Qt? ...

WinApi equivalent of .NET KeyPreview

In .Net there is a feature called KeyPreview. How can I do this in WinApi. Maybe I don't necessarily need this but my hWnd has WM_KEYDOWN, but it does not receive it when my Text Box has focus. How can I achieve this? Thanks *Using pure Win32API... is there an alternative, how could I handle the Text Box's WM_KEYDOWN? ...

trying to sort a simple string in c++

#include "stdio.h" #include "conio.h" #include <iostream> using namespace std; int main (void) { char my_char[] = "happy birthday"; int i; bool j=false; char my_char_temp[1]; do { for (i=0;i<sizeof(my_char)-2;i++) { j=false; if (my_char[i+1] < my_char[i]) {...

C++ delete static_cast<void*>(pointer) behavior

suppose the code does the following: T *pointer = new T(); delete static_cast<void*>(pointer); what is result? Undefined, memory leak, memory is deleted? Thanks ...

C/C++ opaque pointer library

hello Is there library/header already written to manage C++ objects from C using opaque pointers/handles? I can write one myself, but I would rather use already made solution, especially if it has fortran bindings. my specific requirements are: wrapper generation facility (my thought is to use boost preprocessor) handling objects th...

Is Boost.Tuple compatible with C++0x variadic templates ?

Hi, I was playing around with variadic templates (gcc 4.5) and hit this problem : template <typename... Args> boost::tuple<Args...> my_make_tuple(Args... args) { return boost::tuple<Args...>(args...); } int main (void) { boost::tuple<int, char> t = my_make_tuple(8, 'c'); } GCC error message : sorry, unimplemented: cannot expa...

C++ R - tree implementation wanted

Hi, Does anyone know good and simple to use in production code R-tree (actually, any implementations - R*, R+ or PR-tree would be great)? It doesn't matter if it is a template or library implementation, but some implementations that google found look very disappointing... Thanks in advance. ...

Assign RegEx submatches to variables or map (C++/C)

I need to extract the SAME type of information (e.g. First name, Last Name, Telephone, ...), from numerous different text sources (each with a different format & different order of the variables of interest). I want a function that does the extraction based on a regular expression and returns the result as DESCRIPTIVE variables. In ot...

C++ union data-structure, easy acccess of bits within a DWORD

Im running through a set of DirectX tutorials online and I have the following structure: struct CUSTOMVERTEX { FLOAT x, y, z, rhw; // from the D3DFVF_XYZRHW flag DWORD color; // from the D3DFVF_DIFFUSE flag } My basic understanding of directX leads me to thing tha color is made up of 8-bit alpha, red, green and blue channels. ...

Displaying (rendering) HTML from a string in QT

I have html in a QString, what widget can I use to display it? (QWebView is not necessary as I dont access Internet) ...

Which graphical enviroment?

Which graphical environment (MFC, ATL, QT etc.) should I concentrate on, in order to be more employable? I don't want to spend months learning something only to discover that "no one" really use this or this really sucks, and "all" pros are using only such and such. ...