c++

What can be the reason for BeginPaint() always generate a WM_NCPAINT?

I'm facing a problem on Win32 API. I have a program that when it handles WM_PAINT messages it calls BeginPaint to clip the region and validate the update region, but the BeginPaint() is always generating a WM_NCPAINT message with the same updata region even if the touched part that need repaint it's only inside the client region. Do an...

gdb: how to set breakpoints on future shared libraries with a --command flag

I'm trying to automate a gdb session using the --command flag. I'm trying to set a breakpoint on a function in a shared library (the Unix equivalent of a DLL) . My cmds.gdb looks like this: set args /home/shlomi/conf/bugs/kde/font-break.txt b IA__FcFontMatch r However, I'm getting the following: shlomi:~/progs/bugs-external/kde/font...

Best resources for converting C/C++ dll headers to Delphi?

A rather comprehensive site explaining the difficulties and solutions involved in using a dll written in c/c++ and the conversion of the .h header file to delphi/pascal was posted to a mailing list I was on recently, so I thought I'd share it, and invite others to post other useful resources for this, whether they be links, conversion to...

::SendMessage( )

LRESULT result = ::SendMessage(hWnd, s_MaxGetTaskInterface, (WPARAM)&pUnkReturn, 0); The value of result after the call is 0 I expect it to return with a valid value of pUnkReturn , but it returns with a NULL value . Necessary Information before this call : const UINT CMotionUtils::s_MaxGetTaskInterface = RegisterWindowMessage(_T("...

Reuse define statement from .h file in C# code

Hi! I have C++ project (VS2005) which includes header file with version number in #define directive. Now I need to include exactly the same number in twin C# project. What is the best way to do it? I'm thinking about including this file as a resource, then parse it at a runtime with regex to recover version number, but maybe there's a b...

Oracle OCI array fetch of simple data types?

I cannot understand the Oracle documentation. :-( Does anybody have any pointers to an example how to fetch multiple rows of simple data from Oracle via OCI? I currently use OCIDefineByPos to define single variables (I only need to do this for simple integers -- SQLT_INT/4-byte ints) and then fetch a single row at a time with OCIStmtEx...

Is there any way to define a constant value to Java at compile time

When I used to write libraries in C/C++ I got into the habit of having a method to return the compile date/time. This was always a compiled into the library so would differentiate builds of the library. I got this by returning a #define in the code: C++: #ifdef _BuildDateTime_ char* SomeClass::getBuildDateTime() { return _Buil...

If classes with virtual functions are implemented with vtables, how is a class with no virtual functions implemented?

In particular, wouldn't there have to be some kind of function pointer in place anyway? ...

Converting C++ code to HTML safe

I decided to try http://www.screwturn.eu/ wiki as a code snippet storage utility. So far I am very impressed, but what irkes me is that when I copy paste my code that I want to save, '<'s and '[' (http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Character_references) invariably screw up the output as the wiki interprets them as e...

When is it best to use a Stack instead of a Heap and vice versa?

In C++, when is it best to use the stack? When is it best to use the heap? ...

What WPF C# Control is similar to a CWnd in C++?

What would be the best WPF control in C# (VS 2008) that you can place on a form that would allow you to do drawing similar to the "Paint" function for the CWnd class in C++? Also, that could display bitmaps, have a scroll bar, and the ability to accept user inputs (ie. MouseMove, Button Clicks, etc...). Basically all the functionality ...

Why does std::stack use std::deque by default?

Since the only operations required for a container to be used in a stack are: back() push_back() pop_back() Why is the default container for it a deque instead of a vector? Don't deque reallocations give a buffer of elements before front() so that push_front() is an efficient operation? Aren't these elements wasted since they will n...

License / registration frameworks for C / C++

What sort of registration frameworks are available for C / C++ applications? I'm looking for a library that will handle the cryptographic verification of license and registration keys to enable the full features of an application, and optionally disable features after a specified time interval has elapsed. For example, on the Mac one m...

Portable way to catch signals and report problem to the user.

If by some miracle a segfault occurs in our program, I want to catch the SIGSEGV and let the user (possibly a GUI client) know with a single return code that a serious problem has occurred. At the same time I would like to display information on the command line to show which signal was caught. Today our signal handler looks as follows...

How to convert a unmanaged double to a managed string?

From managed c++, I am calling an unmanaged c++ method which returns a double. How can I convert this double into a managed string? Sorry if this is a stupid question, I'm still very new with C++ in .net. Thanks! ...

How do you glue Lua to C++ code?

Do you use Luabind, toLua++, or some other library (if so, which one) or none at all? For each approach, what are the pro's and con's? ...

C++ strings: UTF-8 or 16-bit encoding?

I'm still trying to decide whether my (home) project should use UTF-8 strings (implemented in terms of std::string with additional UTF-8-specific functions when necessary) or some 16-bit string (implemented as std::wstring). The project is a programming language and environment (like VB, it's a combination of both). There are a few wish...

iPhone programming - impressions, opinions?

I've been programming in C,C++,C# and a few other languages for many years, mainly for Windows and Linux but also embedded platforms. Recently started to do some iPhone programming as a side project so I'm using Apple platforms for the first time since my Apple II days. I'm wondering what other developers that are coming to Mac OSX, Xcod...

In C++, why use static_cast<int>(x) instead of (int)x?

I've heard that, in C++, the static_cast function should be preferred to C-style or simple function-style casting. Is this true? Why? ...

Tool for identifying superfluous header files in c++

I wish to scan a very large c++ codebase and identify which header files are being included unnecessarily. CScout seems to have this functionality for c. I need it for c++. ...