c++

How to check if a link exists or not in VC++?

I have a link. I have checked that the link is a valid URL through regular expressions. Now, I want to check if the link is a valid http link or not. i.e. it should not be a non-existing link. Is there a way in VC++ 6.0 (MFC) to check that? ...

How can I get the handle to a Canvas/PictureBox?

I am developing an application which uses the Math Input Panel that comes with Windows 7. The input panel allows users to draw math (using a pen or mouse device) and after recognizing the symbols it sends back MathML(xml). However, I need to get the image of the recognized math as well. I am able to get a window handle for the input pa...

different type of instantiating on c++

Hey there , since I've came from c# to c++ everything looks crazy for me in c++. I just wondering If someone could explain me why do we have these kind of instantiating in c++ : method 1: ClassA obj1; // this is going to stack method 2: ClassA *obj1 = new ClassA(); //this is going to heap whereas we don't have the common instantia...

boost-test application initialisation

I'm just getting stated with boost-test and unit testing in general with a new application, and I am not sure how to handle the applications initialisation (eg loading config files, connecting to a database, starting an embedded python interpretor, etc). I want to test this initialisation process, and also most of the other modules in t...

Inherit interfaces which share a method name

There are two base classes have same function name. I want to inherit both of them, and over ride each method differently. How can I do that with separate declaration and definition (instead of defining in the class definition)? #include <cstdio> class Interface1{ public: virtual void Name() = 0; }; class Interface2 { public: ...

How to draw something to the screen and have the underlying ui interactive

I seeking solution for Windows first. I need to add visual effects to screen image without breaking the interactivity of all and every controls, that are on this screen. The solution can be straightforward: 1. take a screenshot 2. show this screenshot in a separate window, above other windows 3. apply the effect to image, being shown ...

How to set Native Microsoft compiler for VS 2003 if Intel Compiler is default compiler?

Hi, I am using a development environment with VS 2003 as IDE and Intel compiler as default compiler. I have to set Microsoft default compiler for compilation of my project. As I could not find where to set the compiler in VS 2003. Thanks Anil ...

C++ - global setlocale works, the same locale passed to _vsnprintf_l doesn't

I have following C++ code sample: void SetVaArgs(const char* fmt, const va_list argList) { setlocale( LC_ALL, "C" ); // 1 m_FormatBufferLen = ::_vsnprintf(m_FormatBuffer, Logger::MAX_LOGMESSAGE_SIZE, fmt, argList); setlocale( LC_ALL, "" ); //2 m_FormatBufferLen = ::_vsnprintf(m_FormatBuffer, Logger::MAX_LOGMESSAGE_SIZE, ...

Add Exception to firewall on Mac either during istallation of application or when application is launched.

Hello All, I have a client - server application, where I want to add a exception to firewall so that my applications can communicate properly. I want to add add an exception to the firewall (without changing the setup for the other firewalls options). I am using Carbon, Qt, C++. However, I feel this has more to do with some install tim...

VC++ SSE intrinsic optimisation weirdness

I am performing a scattered read of 8-bit data from a file (De-Interleaving a 64 channel wave file). I am then combining them to be a single stream of bytes. The problem I'm having is with my re-construction of the data to write out. Basically I'm reading in 16 bytes and then building them into a single __m128i variable and then using...

Qt app text size incorrect under MacOSX

Designing UIs with QtCreator under Windows, and porting the same .ui file under MacOSX leads to designs with some text parts very small -- actually, the HTML ones. It seems it comes from the fact that QtCreator uses pt instead of px as text size unit, and that the default screen resolutions are quite different under Windows and MacOSX. ...

Message queuing solutions?

(Edited to try to explain better) We have an agent, written in C++ for Win32. It needs to periodically post information to a server. It must support disconnected operation. That is: the client doesn't always have a connection to the server. Note: This is for communication between an agent running on desktop PCs, to communicate with a s...

Quartz display services replacement for deprecated functions?

The Quartz display services reference manual lists several functions as deprecated, (for example CGDisplayCurrentMode), but doesn't mention what the replacement function is. What should I be using to find information about the current video mode? Is there a way to find out this kind of information? The reference manual on the apple de...

MFC: Floating toolbar window not visible (WS_EX_TOOLWINDOW)

In a typical MFC C++ dialog, I want to dynamically create a floating ListBox (or other standard control) over the dialog, possible extending past the dialog's boundaries - so it can't be a simple child or it'll be clipped. Looking at something similar that works, I tried to achieve it but the window never appears when shown. In my .h f...

Extract the return type of a function without calling it (using templates?)

I'm looking for a way in C++ to extract the return type of a function (without calling it). I presume this will require some template magic. float Foo(); int Bar(); magic_template<Foo>::type var1; // Here 'var1' should be of type 'float' magic_template<Bar>::type var2; // and 'var2' should be of type 'int' I am currently investigati...

Linking MTL (Matrix Template Library) in Visual Studio

I have MTL header files; I want to use those header files in Visual Studio 2008. How can I link those header files so that I can write a matrix program using the MTL library? ...

changing the value of const variable in C++

I am trying to change the value of a variable which is defined as int const as below. const int w = 10; int* wp = const_cast <int*> (&w); *wp = 20; The value of w didn't change and was 10 even after the assignment, though it shows as if both w and wp are pointing to the same memory location. But I am able to the change the value of w,...

Tool for detecting pointer aliasing problems in C / C++

Is there a tool that can do alias analysis on a program and tell you where gcc / g++ are having to generate sub-optimal instruction sequences due to potential pointer aliasing? ...

COleSafeArray / VARIANT memory leak?

I want to export a lot of (table) data to Excel. I'm developing on Windows Xp, Vs2005. I'm filling a COleSafeArray, which was initialized like this: safeArray.Create( VT_VARIANT, 2, numElements ); // 2 dimensional, 30000 rows, 3 columns Now the filling is really fast, but in TaskManager/Process Explorer/VMMap, it looks like some of th...

Getting location of file tnsnames.ora by code

How can I get the location of the tnsnames.ora file by code, in a machine with the Oracle client installed? Is there a windows registry key indicating the location of this file? ...