c++

How to create a resizable window with rounded-corners in win32

I'm trying to create a Win32 window that has rounded corners and is resizable both horizontally and vertically. My first approach was to create BITMAP of a rounded rectangle and draw it to the screen in conjunction with setting the windows style to WS_EX_LAYERED and setting the transparency key to the outside color of the rounded rectang...

A good place to learn about image processing in c/c++?

any websites, books etc. If someone would like to share their own experiences. thank you ...

Using default in a switch statement when switching over an enum

What is your procedure when switching over an enum where every enumeration is covered by a case? Ideally you'd like the code to be future proof, how do you do that? Also, what if some idiot casts an arbitrary int to the enum type? Should this possibility even be considered? Or should we assume that such an egregious error would be cau...

When program run correctly while debugging but otherwise not?

Possible Duplicate: Common reasons for bugs in release version not present in debug mode Sometimes I encouter such strange situations that the program run incorrectly while running normally and it will pop-up the termination dialog,but correctly while debugging.This do make me frustrated when I want to use debugger to find the...

conversion of multiple ascii characters in a char array to single int using their ascii values --- c/c++

hi, anyone know a good way for doing this conversion? for example, take the char array holding ascii charcters "ABC", the int conversion i'm looking for would change those characters to a single int with value 656667. any help would be very much appreciated. edit really appreciate the replies. as someone noted i did say char array, an...

_heapwalk reports _HEAPBADNODE, causes breakpoint or loops endlessly

I use _heapwalk to gather statistics about the Process' standard heap. Under certain circumstances i observe unexpected behaviours like: _HEAPBADNODE is returned some breakpoint is triggered inside _heapwalk, telling me the heap might got corrupted access violation inside _heapWalk. I saw different behaviours on different Computers....

Problem using yaml-cpp on OS X

So I'm having trouble compiling my application which is using yaml-cpp I'm including "yaml.h" in my source files (just like the examples in the yaml-cpp wiki) but when I try compiling the application I get the following error: g++ -c -o entityresourcemanager.o entityresourcemanager.cpp entityresourcemanager.cpp:2:18: error: yaml.h: ...

Sending struct via Socket using JAVA and C++

I have a socket where server is in JAVA but Client is in C++. Struct{ float length; char[] name; }myStruct; How can I convert the structures to a byte stream sent by Server and can be correctly parsed by Client? Any sample code would help! (I heard XML is an option but I am not familiar with it ) Thanks. ...

Map from integer ranges to arbitrary single integers

Working in C++ in a Linux environment, I have a situation where a number of integer ranges are defined, and integer inputs map to different arbitrary integers based on which range they fall into. None of the ranges overlap, and they aren't always contiguous. The "simplest" way to solve this problem is with a bunch of if-statements fo...

Calling a custom type from a DLL written in C++ from c#

I'm using a DLL written in c++ in my C# project. I have been able to call functions within the DLL using this code: [DllImport("hidfuncs", EntryPoint = "vm_hid_scan", ExactSpelling = true, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr VmHidScan(); Now I need to call a functi...

CreateObject equivalent in C/C++? (COM Interop)

What would the equivalent in C/C++? ...

how do i turn my program into something i can install?

how do i turn my VC++ 2008 program into something i can get to run on other computers. i have tryed using the .exe it makes in the debug but it will say that im missing some files and lists all of my .cpp file names and .h files(if i use it on other computers). i wanted something so i could encrypt my files because one of them is about e...

How to generate pseudo random in cuda

I am attempting to build a particle system utilizing CUDA to do the heavy lifting. I want to randomize some the particles initial values like velocity and life span. The random numbers don't have to be super random since its just for visual effect. I found this post that addresses the same subject http://stackoverflow.com/questions/8...

Does using a C++ namespace increase coupling?

I understand that a C++ library should use a namespace to avoid name collisions, but since I already have to: #include the correct header (or forward declare the classes I intend to use) Use those classes by name Don't these two parameters infer the same information conveyed by a namespace. Using a namespace now introduces a third p...

Is there support in C++/STL for sorting objects by attribute?

I wonder if there is support in STL for this: Say I have an class like this : class Person { public: int getAge() const; double getIncome() const; .. .. }; and a vector: vector<Person*> people; I would like to sort the vector of people by their age: I know I can do it the following way: class AgeCmp { public: bool oper...

Bind a chunk of preformatted XML to an external variable in xquery in QtXmlPattern.

I use QT xmlpatterns in XQuery mode to implement templates. The template is an QXmlQuery object and the variables are filled-in using bindVariable(). So far the variables were strings and everything worked fine. Now, I want to inser preformated chunks of XML into the template. I would like to create a piece of xml in C++ using QXmlStr...

How to call a c++ class and its method from a c file

Hi, I am trying to call a C++ class and its method from a c file. I google this topic and find this http://developers.sun.com/solaris/articles/mixing.html It says " You can write extern "C" functions in C++ that access class M objects and call them from C code. Here is a C++ function designed to call the member function foo: extern ...

Should C# or C++ be chosen for learning Games Programming (consoles)?

I've basic game programming knowledge in c and c++. I'm learning c# nowadays. If I want to make a career in console games programming, which one I should use to proceed? I've noticed that a lot of game companies are using C++/C (probably because of legacy reasons). Also probably C++ enjoys more number of supported libraries? In which lan...

Is there a C++ equivalent to getcwd?

I see C's getcwd via: man 3 cwd I suspect C++ has a similar one, that could return me a std::string . If so, what is it called, and where can I find it's documentation? Thanks! ...

Effect on performance when using objects in c++

Hey, I have a dynamic programming algorithm for Knapsack in C++. When it was implemented as a function and accessing variables passed into it, it was taking 22 seconds to run on a particular instance. When I made it the member function of my class KnapsackInstance and had it use variables that were data members of that class, it started...