c++

Extract sound from video

I'm currently doing my Multimedia assignment where I have to create a new video using one video as a foreground and another as a background. OpenCV allows me to do just that: extracting images from each frame in video, processing them and putting the results back into a video format. However, OpenCV is only a computer vision library. Is ...

Custom iterator which converts values before saving it

A typical forward iterator is expected to implement following methods: value_type& operator*(); value_type* operator->(); I'm writing a custom iterator for a custom container where user expects to see a value_type different from representation of the value inside a container. So when returning a value_type value to user I convert it f...

Determine if the current thread has low I/O priority

if (reader.is_lazy()) goto tldr; I have a background thread that does some I/O-intensive background type work. To please the other threads and processes running, I set the thread priority to "background mode" using SetThreadPriority, like this: SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); However, THREAD_MODE...

ESRI Map object - Is it possible to disable the MouseWheel event handler?

Hi there. I've posted this on the ESRI support forum, but no one has come back with a solution as yet. Background: I'm maintaining a C++ map display application that makes use of ESRI ArcGIS components (version 9.3.1 SP1). It instantiates a Map object (esriCarto::Map), queries for the IActiveView interface, and calls Activate to pass ...

How to reverse PNG for drawing

I make game Mario and I want when I use left key < , the character will turn his head to left :-? How can I implement that ? Thanks for reading this :) ...

Can't I send NULL as a parameter with a constructor?

Lets say i have a Shape object that has a constructor like this: Shape( width, height, radius, depth ) Now, I just have a silly rect so i dont need redius and depth... is it okey to do Shape myRect(50, 50, NULL, NULL) ? I know its not the best idea and I should use inheritance and stuff but this is the mess im in so can i use NULL...

What's the purpose of `qt_noop`

I just found the existence of qt_noop() define in the qglobal.h as: inline void qt_noop() {} What's the point of it? ...

What is the best way to call MSWord from C++

Hi, my question is: What is the best way to call MSWord from C++ I never did this before. I always used VB6 and the Word-COM-Library: C:\Program Files\Microsoft Office\OfficeXX\MSWORD.olb resp: "Microsoft Word XX.0 Object Library" how should I use/call Word from C++ (VS2010) ? should I use .NET ? (C++CLI) do you have a good step by ...

VB6 Require some help with looping

Hi, I am trying to convert a source from C++ to vb6: C++: static double mdArray[3][3]; static double mdArray2[3][3]; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) { double sum = 0; for(k = 0; k < 3; k++) sum = sum + mdArray[k][i] * mdArray[k][k]; mdArray2[i][j] = sum } VB6: dim mdArray(0 to 2, 0 to 2) as integer dim m...

UTC timestamp in milisecond using c++ under windows

How to get the UTC time in milliseconds under windows platform. I am using Standard library which give me UTC time in seconds, I want to get time in miliseconds, kindly give me the reference of any other library which give me the accurate UTC time in miliseconds. ...

Defining _LIBC in C++ Program

Some of the GNU library code can be have enhanced debugging if the flag _LIBC is set. While using -D_LIBC when compiling gives the error message "/usr/include/gnu/stubs.h:7:3: #error Applications may not define the macro _LIBC" So how do you define this variable? ...

Problem building stripped down version of Qt 4.6.2

I'm trying to build a smaller version of Qt, I used the following configuration options: ./configure -qt-sql-mysql -no-qt3support -no-audio-backend -no-phonon -no-phonon-backend -no-opengl -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-multimedia -fast After executing make, I eventually run into the following err...

Template specialization within template definition: is this supported for all compilers or standard usage?

This compiled on VS 2008, but it seems like non-standard usage of templates. template <class T> class Foo { public: void bar(Foo<int> arg) { // do some stuff here } // more code ... }; Is there an issue since the template specialization Foo<int> is contained within the definition of its own template class? ...

Why can't we overload "=" using friend function?

Why it is not allowed to overload "=" using friend function? I have written a small program but it is giving error. class comp { int real; int imaginary; public: comp(){real=0; imaginary=0;} void show(){cout << "Real="<<real<<" Imaginary="<<imaginary<<endl;} void set(int i,int j){real=i;imaginary=j;} friend comp operator=(comp &op1,cons...

Bit manipulation, permutate bits

Hi. I am trying to make a loop that loops through all different integers where exactly 10 of the last 40 bits are set high, the rest set low. The reason is that I have a map with 40 different values, and I want to sum all different ways ten of these values can be multiplied. (This is just out of curiosity, so it's really the "bitmanip"-...

Marshalling an array of shorts: "Mismatch has occurred"

I have the following C++ struct: typedef struct FormulaSyntax{ WORD StructSize; short formulaSyntax [2]; } FormulaSyntax; I have a DLL method which takes an instance of this struct. Here's what I've tried on the C# side: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct For...

Draw to an Image

I'm new to GDI+ and I don't know how to draw to an Image. I've a matrix ( game map ) and tiles, Can I create an Image or a Bitmap, then I draw everything on it, so I can work with it likes an Image I load from resources. Thanks so much :) ...

Who deletes the copied instance in + operator ? (c++)

Hello, I searched how to implement + operator properly all over the internet and all the results i found do the following steps : const MyClass MyClass::operator+(const MyClass &other) const { MyClass result = *this; // Make a copy of myself. Same as MyClass result(*this); result += other; // Use += to add other to t...

DeferWindowPos and SWP_SHOWWINDOW/SWP_HIDEWINDOW

I am writing a virtual desktop application which utilises the DeferWindowPos API functions. The current method I am using is moving the windows off the screen if they're not on the current virtual desktop. However I know wish to also hide the windows that are off-screen so they do not appear on the task bar. I have attempted this by also...

BYTE typedef in VC++ and windows.h

Hi, I am using Visual C++, and I am trying to include a file that uses BYTE (as well as DOUBLE, LPCONTEXT...) , which by default is not a defined type. If I include windows.h, it works fine, but windows.h also defines GetClassName wich I don't need. I am looking for an alternative to windows.h include, that would work with VC++ and wou...