visual-c++

In C++/CLR, what does a hat character ^ do?

I was reading Ivor Horton's Beginning Visual C++ 2008 and many of its CLR examples have int main(array<System::String ^> ^args) definition for main. I went back, page by page, to the beginning of the book to find first such instance with an explanation what it really means, but couldn't find one. Obviously it means the same as the st...

vc++ Line Graph Example

Can someone please provide me with a hint on how to draw a line graph in vc++ 6.0? ...

Make hosted WebBrowser control inherit tab background?

I've run into a problem where I can't really find a good, low maintenance solution. We're trying to integrate our hosted ActiveX WebBrowser control in a dialog box with tabs (the native C++ tab control) better, such as having its HTML font use the "Shell Dlg" font, removing the 3D border for the WebBrowser control, and making its backgro...

Simple object-oriented 2D graphics framework for use in Visual C++?

We're building a method of connecting components visually via a GUI in a Visual C++ application (MFC). Simple things like clicking on boxes and drawing lines between those that are connected, and storing information on them. The problem is that we're making all this by ourselves from the ground up in GDI and it quickly becomes a heck of ...

Adding resource file to VC6 dll

I have a number of VC 6.0 projects (dsps) which build into dlls which don't have resource files. Any idea how to add resources into an existing project? The project is due for a major release shortly and I want to add a fileversion to those dlls currently lacking one. The dlls will be recompilied before release so I'm just trying to mak...

Detecting a single mouse click in MFC

In MFC a double-mouse click event triggers the following sequence of messages WM_LBUTTONDOWN WM_LBUTTONUP WM_LBUTTONDBCLK WM_LBUTTONUP So responding to the WM_LBUTTONDBCLK message allows you to detect a double-click. But if I just want to detect a single-click how to I distinguish it? But just looking at the WM_LBUTTONUP message isn...

C++ 'true' and 'false' keywords suddenly not true or false in Visual C++ 6.0

My compiler (VC++ 6.0 sp6) has apparently gone insane. In certain pieces of code I'm seeing that 'bool mybool = true;' evalutes to and assigns false, and vice versa for true. Changing the true/false keywords to 1/0 makes it work fine. The same code compiles elsewhere fine without changing the true/false keywords. What could possibly ...

The compilation process

Can anyone explain how compilation works? I can't seem to figure out how compilation works.. To be more specific, here's an example.. I'm trying to write some code in MSVC++ 6 to load a Lua state.. I've already: set the additional directories for the library and include files to the right directories used extern "C" (because Lua i...

How can I capture a stack trace on the QA computers

I am writing a Qt/C++ application, up until this month I have been using Mingw for compiling and drmingw for getting the stack trace from the QA people. However I recently converted over to MSVC++ 9 so that I can use the phonon framework. The downside is that now the stack traces from drmingw are useless. What do others use? ...

How to validate numeric input C++

I'd like to know how to limit an input value to signed decimals using cin. (C++) ...

macro "max" requires 2 arguments, but only 1 given

template <class T> struct scalar_log_minimum { public: typedef T value_type; typedef T result_type; static result_type initial_value(){ return std::log(std::numeric_limits<result_type>::max()); } static void update(result_type& t, const value_type& x){ if ( (x>0) && (std::log(x)<t) ) t = std::log(x); } }; i got the foll...

Using GDI+ Bitmap

Hi I am using GDI+ Bitmap class to convert an IStream to HBITMAP. I have included the gliplus lib file in the Linker inputs and also have the dll in the build path. But using the statement Bitmap bm(lpStream,FALSE); gives me an error C2065: 'Bitmap' : undeclared identifier Can someone please tell me what I am doing wrong here. Tha...

Using IStream to open a file

Hi I am getting the contents of a file in an IStream object. I want to be able to open the IStream contents in a Windows program based on the extension of the file (I know the extension and the mime types) from a dll where I am getting this object. Can someone please tell me how to go about with this. Thanks. ...

Trouble examining byte code in MSVC++

I've been messing around with the free Digital Mars Compiler at work (naughty I know), and created some code to inspect compiled functions and look at the byte code for learning purposes, seeing if I can learn anything valuable from how the compiler builds its functions. However, recreating the same method in MSVC++ has failed miserably ...

Using char array properly in vc++

Hi I am trying to convert an IStream to HBITMAP using the GDI+ Bitmap class. The IStream object is being populated by using data from a web service. I am reading the data in parts and appending it to an object to be used later with the Bitmap class. Here is the relevant part of the code char data1[] = ""; int offset = 0; LPTSTR...

Get icons for common file types

Hi I want to get the icons of common file types in my dll. I am using vc++. I only have the file extension and mime type of the file based on which I want to get the icon for the file. Can someone please tell me how I can do that? (The method available in vc++ needs the user to give the path of the file for which the icon is needed. I ...

Append data to an IStream object

Hi I am making calls to a web service to get data from my dll. I am getting the data in a char* object in parts. I want to get the whole data into an IStream object. I am running a while loop and getting the data into char* object. Can someone please tell me how I can combine all this data into a single IStream or LPSTREAM object. Tha...

Need way to determine whether function has void return type in VC6 and VC7

The following C++ code compiles and runs correctly for GNU g++, LLVM and every other C++ compiler I threw at it except for Microsoft VC6 and VC7: template<typename A, typename B> int HasVoidReturnType(A(*)(B)) { return 0; } template<typename B> int HasVoidReturnType(void(*)(B)) { return 1; } void f(double) {} int foo() { return HasVoidR...

Windows API and .net languages

People always advised me that if I am doing some application that should use some Windows APIs to do any process level job, I must use VC++ and not any other .net language. Is there any truth in that? Can everything that can be done using VC++ be done in other .net languages also? Are all the .net languages the same when their capabil...

Is there a way to disable all warnings with a pragma?

I've started a new project and have decided to make sure it builds cleanly with the /Wall option enabled. The only problem is not all 3rd party libraries (like boost) compile without warnings, so I've resorted to doing this in a shared header: #pragma warning(push) #pragma warning(disable:4820) #pragma warning(disable:4619) #pragma war...