c++

show image in gtkmm from integer array

I have an integer array with a gray scale image and I need to show it in my application. I'm programing in C++ with gtkmm and I can't find any widget like a canvas that allow you to show and access each pixel in the image. ...

Can I change dll-interface without recompilation exe-file?

I have an abstract class in my DLL. class Base { virtual char * First() = 0; virtual char * Second() = 0; virtual char * Third() = 0; }; This dinamic library and this interface are used for a long time. There is my mistake in my code. Now I want to change this interface class Base { virtual const char * First() const = 0; ...

Grab exclusively/release mouse in application (Windows, C++)

Hello. I have lost many hours trying to grab exclusively the mouse in my application and re-releasing it. Right now, I am grabbing it correctly : the mouse cursor disappears from screen and I can read its properties fine. However, I can't release it correctly! The mouse cursor reappears on screen but no other application is receiving a...

std::string a container

Is std::string a container class in standard c++ library, restricted to hold only char elements? ...

Non blocking socket from within a DLL (no window)

Hi all, I have a DLL wich connects to a server through a single socket. I am facing the following problem : If server's IP address & port are false or server is down, the application using this DLL freezes until half a minute. My idea is to use non-blocking sockets to avoid that problem, by showing a window indicating connection progres...

Using Boost on Windows (Visual Studio)

I want to get started using Boost. I'm programming a C++ program in Visual Studio (obviously on a Windows machine). Boost's Getting Started Guide says: The easiest way to get a copy of Boost is to use an installer. The Boost website version of this Getting Started guide will have undated information on installers as they become avai...

Redirect std::cout to newly created console

When you create a C++ console application under Windows you automatically get the console window created for you and std::cout outputs to the console window. I have a GUI application for which I also want to create a console window. I can create the console window using the AllocConsole() function, but how do I redirect / attach std::c...

Difference between [square brackets] and *asterisk

If you write a C++ function like void readEmStar( int *arrayOfInt ) { } vs a C++ function like: void readEmSquare( int arrayOfInt[] ) { } What is the difference between using [square brackets] vs *asterisk, and does anyone have a style guide as to which is preferrable, assuming they are equivalent to the compiler? For completene...

Get Directory from User

I'm looking for a function to get a directory path from the user; I need to solicit a place to put things. I tried using GetOpenFileName() with .dir as a filter but no joy. I found something called GetDirectoryViaBrowse() that sounds like it might do what I want but it's part of some wizard making package and my Visual Studio knows not...

external vs internal linkage and performance

let's say i have 3 functions inside a class : class Foo { inline void FooInline() { /* bla bla */ } static void fooStatic(); void foo(); }; as i understand the last two have external linkage while the first have internal. i want to know which function will be the fastest to call to , and what's the tradeoff. thanks ...

Popup window appearing while stopping the C process

I am calling a C process from my Java program, and ending that C process using exit (0). On Windows machine, under certain conditions it is opening a pop-up window telling me that "Test.exe has encountered a problem and needs to close. We are sorry for the inconvenience." Does anyone have a guess why this problem is coming around? I ...

Is this possible to call c/c++ application from DB2 stored procedure/trigger?

Is this possible to call c/c++ application from DB2 stored procedure/trigger? If yes, what would be general steps doing it? Any pointers to web resources on the subject? Thanks! ...

How do I convert a char string to a wchar_t string?

I have a string in char* format and would like to convert it to wchar_t*, to pass to a Windows function. ...

Assembler and C++ relation

Is there any tutorial or explanation anywhere on how C++ objects translate into assembler instructions moving data between registers... I don't really understand how we are manipulating object in higher level languages where in Assembler you're essentially moving data between registers? Plus doing some basic operations on them. ...

Comparing character arrays and string literals in C++ without cstring

In my programming class we currently have a project that requires us to take arguments into the program. I then need to be able to check one of the arguments to see which value was passed to the program so that I can choose the appropriate behavior for the program to follow. In a previous homework assignment I did this with the strcmp fu...

Default template parameters with forward declaration

Is it possible to forward declare a class that uses default arguments without specifying or knowing those arguments? For example, I would like to declare a boost::ptr_list< TYPE > in a Traits class without dragging the entire Boost library into every file that includes the traits. I would like to declare namespace boost { template<class...

Difference between WinMain and wWinMain

The only difference is that Winmain takes char* for lpCmdLine parameter, while wWinMain takes wchar_t*. On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application? If the command line parameter must be in Unicode (for example, Unicode file name, conversion...

QT set window background

I have scoured through the documentation looking for a way to change the main window's background to an image I have located in the project file. I tried to use a palette with no luck. My question is, how and what is the easiest way to change the background of a window? Thank You for any help, Zach Smith ...

What are the limits of Python?

I spent a few days reading about C++ and Python and I found that Python is so much simpler and easy to learn. So I wonder does it really worth spending time learning it? Or should I invest that time learning C++ instead? What can C++ do and Python can't ? ...

How I can use mysql in C++?

I have searched a lot, all I found is a "mysql++" but I don't know how to install it. I don't have knowledge about libraries in C++! ...