c++

Forward declaration problem

I'm using C++ .NET 2.0 I have 2 forms the first one is declared as follow #include "stdafx.h" namespace myNamespace{ public ref class frmMain : public System::Windows::Forms::Form { /*... snip ...*/ public void addNewRow(String^ text){ /*... snip... */ } public void launchSubForm() { SubForm^ sf = gcnew S...

Building both DLL and static libs from the same project

I have a number of native C++ libraries (Win32, without MFC) compiling under Visual Studio 2005, and used in a number of solutions. I'd like to be able to choose to compile and link them as either static libraries or DLLs, depending on the needs of the particular solution in which I'm using them. What's the best way to do this? I've...

Are data structures an appropriate place for shared_ptr?

I'm in the process of implementing a binary tree in C++. Traditionally, I'd have a pointer to left and a pointer to right, but manual memory management typically ends in tears. Which leads me to my question... Are data structures an appropriate place to use shared_ptr? ...

How to load default settings with KConfig on kdelib?

I've a question about KConfig usage. I'm able to write and read settings in my .kde4/share/config/_appname_rc configuration file like that KConfig basicconf; KConfigGroup conf = KConfigGroup(basicconf.group("Settings")); conf.writeEntry("filepath",QString("/path/")); basicconf.sync(); But I don't understand how to use a "default" ...

Using C/C++ static libraries from iPhone ObjectiveC Apps

Is it possible to have a C static library API, which uses C++ internally and hide this from users of the library? I have writen a portable C++ library I wish to statically link to an iPhone application. I have created an Xcode project using the Max OS X 'static library' template, and copied the source across, as well as writing a C wap...

Visual c++ 2008: how to have global settings defined in a solution

I have a number of solutions with a large number of projects in them. I would like to be able to define global settings for the solution that are used by all projects. For example an include directory. I want to be able to change the include directory in one place for all projects in the solutions. When I searched for a solution I foun...

GDI+ Dithering Problem

I have a C++ application that uses the Win32 API for Windows, and I'm having a problem with GDI+ dithering, when I don't know why it should be. I have a custom control (custom window). When I receive the WM_PAINT message, I draw some Polygons using FillPolygon on a Graphics device. This Graphics device was created using the HDC from Beg...

What's your preferred pointer declaration style, and why?

I know this is about as bad as it gets for "religious" issues, as Jeff calls them. But I want to know why the people who disagree with me on this do so, and hear their justification for their horrific style. I googled for a while and couldn't find a style guide talking about this. So here's how I feel pointers (and references) should be...

How does the standard new operator work in c++?

What are all the other things a new operator does other than allocating memory and calling a constructor? ...

Can someone explain the c++ FAILED function?

I've seen a lot of example c++ code that wraps function calls in a FAILED() function/method/macro. Could someone explain to me how this works? And if possible does anyone know a c# equivalent? ...

C++ char array with stdin

I am trying to get the size of an array populated by stdin: char *myArray; cin >> myArray cout << sizeof(myArray); This returns 4 when I enter a string greater with a length greater than 4 e.g. "40905898" Where am i going wrong? ...

WinApi C++, How to open a window push down a button?

I have created a "check Box " window with a button, when the button is clicked, It should open a "Edit" window, How can I do? thanks ...

How to fill the screen with video preview on Windows Mobile

Hi, I am creating an application for video capturing on Windows Mobile device. In the MainFrame there are menu and status window (custom window). The video size width:height ratio is 4:3 so in the case there are some other elements on the screen the video doesn't fill the whole area. This is the function which arranges screen elements:...

Does anybody have any experience with SSEPlus?

SSEPlus is an open source library from AMD for unified handling of SSE processor extensions. I'm considering to use this library for my next small project and would like to know, if anybody have experience with it? Can I use it on Intel machines? Any performance issues in comparison to direct SSE calls? Any issues on 64bit machines? Wha...

C++ How can I iterate till the end of a dynamic array?

suppose I declare a dynamic array like int *dynArray = new int [1]; which is initialized with an unknown amount of int values at some point. How would I iterate till the end of my array of unknown size? Also, if it read a blank space would its corresponding position in the array end up junked? Copying Input From users post below: ...

C++ sql pass integer to sql string

Hello, after a lot of research i think its time to ask some questions. So this is how it goes. I have built a database in Ms Access. There i have a table called Customers which also has a cell called Employee type: integer. I also built a program in C++ which controls all data. I have a problem thought. lets say i have a string like th...

Debugging GUI Applications in C++

Background: I'm currently debugging an application written over a custom-built GUI framework in C++. I've managed to pin down most bugs, but the bugs I'm having the most trouble with tend to have a common theme. All of them seem to be to do with the screen refreshing, redrawing or updating to match provided data. This is a pain to debug,...

Why is my WM_UNICHAR handler never called?

I have an ATL control that I want to be Unicode-aware. I added a message handler for WM_UNICHAR: MESSAGE_HANDLER( WM_UNICHAR, OnUniChar ) But, for some reason, the OnUniChar handler is never called. According to the documentation, the handler should first be called with "UNICODE_NOCHAR", on which the handler should return TRUE if you...

How can I debug a win32 process that unexpectedly terminates silently?

I have a Windows application written in C++ that occasionally evaporates. I use the word evaporate because there is nothing left behind: no "we're sorry" message from Windows, no crash dump from the Dr. Watson facility... On the one occasion the crash occurred under the debugger, the debugger did not break---it showed the application s...

How to speak SSL from a Windows MFC client?

Hi, I've an MFC application that currently uses CAtlHttpClient to query a web server for some information. I'd like to change this so that the query goes over securely, with server authentication, using SSL. Googling reveals that Microsoft has changed the way they support this several times, e.g., WinInet, WinHTTP, but for the life of...