c++

how do aim bots in fps games work?

I was curious if anyone had any experience/knowledge about aim bots in online FPS games such as Counter-Strike. I am curious and would like to learn more about how the cursor knows how to lock on to an opposing player. Obviously if I wanted to cheat I could go download some cheats so this is more of a learning thing. What all is involved...

Game programming for windows in C++ or C#.

I just learned the basics of c++ and c#,just the simple basics of the language.And I want to pursue game programming can anyone please tell me where to start off I read somewhere that Direct-X is used for game programming and I downloaded it from Microsoft's website but I just didn't understood it.From where did you people started your g...

Are thread and process ids unique?

I am using a static library; it has a function which uses the current time and creates a unique id, which is then inserted into my database. This number should be unique in my database table. There are two processes running in parallel. Sometimes they simultaneously call this function, and the same number is generated. I get an integr...

Track handle creation / deletion

I have a large old program which has some rather complex graphical displays (all via standard API calls). The program appears to be working fine, but I recently looked at the "handles" field of Windows Task Manager when this program was running and noticed that the number of handles was gradually and relentlessly creeping upwards. Is th...

C++ IntelliSense 'auto' feature? Where is it? How to get it 'on'?

I would like to enable the IntelliSense 'auto' feature (like the Visual Studio C# 2008 Express) but I am using Visual Studio C++ 2008 Express Edition and in the Tools > Options > Text Editor > C/C++ (there is no option 'IntelliSense' (like Visual C#). How do I get this feature enabled? I know I can get a shortcut in place (CTRL-space etc...

how to display IBitmapImage on CDC

What is the best way to display IBitmapImage on a device context. I am using Windows CE 6.0. void CImaginingTestView::OnDraw(CDC* pDC) { CImaginingTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); IBitmapImage* pBitmapImage = pDoc->GetBitmapImage(); if (pBitmapImage) { // how to draw my bitmap on a pDC ?? ...

Performance of 32-bit integers in a 64-bit environment (C++)

We've started compiling both 32- and 64-bit versions of some of our applications. One of the guys on my project is encouraging us to switch all of our 32-bit integers to their 64-bit equivalents, even if the values are guaranteed to fit in a 32-bit space. For example, I've got a value that is guaranteed to never exceed 10,000 which I'm...

Including commented Class declaration in implementation file

Hi All, Everyone knows the advantages of a more readable code. So in order to make my code more readable what i do normally is include the commented class declaration in the implementation file of that class. This way i need not have to browse through various include directories to go to the definition. So, Is this a good practice or ju...

Import C++ classes in python?

so.. let's say i have this C function: PyObject* Foo(PyObject* pSelf, PyObject* pArgs) { MessageBox(NULL, "Foo was called!", "Info", MB_OK); return PyInt_FromLong(0); } and then, I have to do this: static PyMethodDef Methods[] = { {"Foo", Foo, METH_NOARGS, "Dummy function"}, {NULL, NULL, 0, NULL} }; Py_InitModule("ba...

I need high performance. Will there be a difference if I use C or C++?

I need to write a program (a project for university) that solves (approx) an NP-hard problem. It is a variation of Linear ordering problems. In general, I will have very large inputs (as Graphs) and will try to find the best solution (based on a function that will 'rate' each solution) Will there be a difference if I write this in C-sty...

ITaskbarList3 undeclared?

I'm trying to write some c++ code to use the ITaskbarList3, but I'm getting that error. I have confirmed that I am including shobjidl.h (but I checked and this file only defines up to ITaskbarList2). I have Visual Studios 2008 (SP1) and I have Microsoft Windows SDK for Windows Server 2008 installed. Does anyone know what I am missing? ...

interpret signed as unsigned

I have a value like this: int64_t s_val = SOME_SIGNED_VALUE; How can I get a uint64_t u_val that has exactly the same bit pattern as s_val, but is treated as unsigned? This may be really simple, but after looking on Stackoverflow and elsewhere I haven't turned up the answer. ...

automake dependency tracking for nonstandard C++ suffix

hello how can i force automake to generate dependency tracking for nonstandard C++ suffix files? in particular I mean generating .deps directory file content. I am using libtool as well. Thanks ...

[C++] Validity of int * array = new int [size]();

int * array = new int [size](); The operator () allow to set all values of array to 0 (all bits to 0). it's called value-initialization. Since which version of g++ is it valid ? What about other compilers ? Where can i find it in standard ? Thank you for your future anwsers. ...

How to subtract one audio wave from another?

How to subtract one audio wave from another? In general and in C# (or if we cannot do it in C# in C/C++) I have sound wave A and sound wave B (BTW: they are in PCM) I want to subtract B from A What do I need? Open Source Libs (NOT GPL, but LGPL will be ok) Tutorials on how to do such operation (with or without using libs) Articles o...

Question about mutexes and locks

Are the two code samples below equivalent? Poco::ProcessHandle::PID ProcessRunner::processId() const { Poco::ProcessHandle::PID pid = 0; mMutex.lock(); pid = mPID; mMutex.unlock(); return pid; } , Poco::ProcessHandle::PID ProcessRunner::processId() const { Poco::ScopedLock<Poco::Mutex> lock(mMutex); return...

Developing ActiveX controls

I would like to develop an ActiveX control and as I don't own visual studio I'm wondering whether I can use VisualC++ express edition on it's own, or do I also need the Windows Platform SDK? ...

boost::format - attempting to use HTML as formatter string - need some help

Hi all, I'm attempting to use boost::format, where my formatting string is the HTML below. I intend to insert 3x std::strings at locations specified by %s placeholders. In other words - I'm opening the below *.html file for reading, read it's contents into a single std::string and use it as the formatter. Next I'm attempting to do the f...

Binary Search Tree C++ (Parents)

Hello. I need just a little more help on my BST. This is what my BST looks like when inserting: R, L, J, G R --Root at Index 0 / \ L @ Index1 L NULL / \ J @ Index3 J NULL / \ G @ Index7 G NULL Here is the code that makes it happ...

Need help understanding using c++ map as an asscoiative array

I was going through Josuttis's "Using Map's as associative arrays" and came across Using a std::map as an associative array in this forum. Now I have more questions on the constructors that are called when inserting into map. Here is my sample program, ( Not using best coding practices, excuse me for that) class C { public: string ...