visual-c++

On Visual C++, How to make a simple paint program?

I want to make a simple paint program on visual c++ which allows the user to draw a path of a series of straight lines which follow on from each other. Once the user is done this, they should double click to stop drawing. It is important that I record the co-ordinates of the beginning and end points of each line of the path because I wan...

How can I calculate the client area of an MFC CDialog without displaying it?

How can I obtain the Window Rect of a CDialog which is based on a dialog template. The dialog is not and can not be visible ...

MFC : creating a hyperlink in a button

Hi All, Is there an easy way in MFC to add a hyperlink in a button? I've searched the net and they seem to offer complicated stuff. Thanks. ...

run time detection of processor type - atomic operations

I am implementing some speed critical multithreaded code. I can avoid having some critical sections if I know for certain that some basic write operations are atomic. I just read an academic paper in which I saw the following: "Writes of the basic types size t, int, float and pointer must be atomic. Writes by one thread must be seen by ...

TitleCase In Visual C++

I'm currently trying to find an easy way to convert a Visual (Managed) C++ string to title case. In VB.NET, you can use either: StrConv(sampleString, vbProperCase) or sampleString = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ToTitleCase(sampleString) In C# you use: sampleString = System.Globalization.CultureInfo.Cu...

Do the new ATL CComModule replacements implement RegOverridePredefKey correctly?

I have a project that stated in an old version of Visual C++, so it uses CComModule. The only problem is that I set up RegOverridePredefKey to install in HKCU if HKCR fails. This works fine in XP, but on Vista, the implementation is broken! I found some posts on the internet corroborating that it is indeed broken. I was wondering: 1) ...

CMake, Microsoft Visual Studio, and Monolithic Runtimes

Hello all :) I'm building a file using the CMake Build System and Microsoft's Visual C++ compiler. When I have CMake generate the visual studio project, the project contains the commandline to build a "Multi Threaded DLL" type of runtime -- one which depends on msvcrt.dll. For various reasons I'm not going into right now, I cannot depen...

XCode will not take input from a file.

For some reason, Xcode will not take input from a file, while Visual C++ will. When I run this program in xcode, the variables numberRows and numberCols stay 0 (they are initialized to 0 in the main function). When I run it in Visual C++ they become 30 and 30 (the top line of maze.txt is "30 30" without the quotes). Any ideas why this...

Visual Studio 2008 c++ conditional template inheritance bug?

I'm in the process of porting a C++/WTL project from Visual Studio 2005 to VS 2008. One of the project configurations is a unit-testing build, which defines the preprocessor symbol UNIT_TEST. In order to get my WTL classes into my test harness, I made a CFakeWindow class that stubs all the CWindow methods. Then in my stdafx.h file, I do...

Move a bitmap around a window quickly in C++

I'm looking for some C++ code to let me quickly move a bitmap around a window, restoring the background as it moves. At present I capture the Window contents to a bitmap during the app initialization and in the OnPaint() I draw the this bitmap and then I draw my overlayed bitmap. I am double buffering the paint. The overlayed bitmap posi...

How to determine if a file is in a removable drive or in the local drive

How do you determine if a file is on a removable drive or in the local drive in vc++? ...

How to Enable/Disable Jumbo Frames in NIC Card using VC++ [Programmatically]

Hi, I wanted to know how to enable or disable jumbo frames for Installed NIC Card Programmatically.. For Installed NIC Card..We can set in using GUI..But i wanted to do it Programmatically in VC++ Answers will be Highly Appreciated. Thanks in Advance. ...

Building a primitive debugger in Visual C++

I'd like to build a primitive debugger in Visual C++ that does few basic things: 1) Attaches to a running process. 2) Sets breakpoints in the applications. 3) Reads register values. How involved is this, and where does one start? ...

How does Install Shield "COM Extract at Build" work?

Our product contains a VC++ ATL in-proc COM server with two COM-exposed classes - ClassA and ClassB. This COM server is added into an Install Shield 2008 installer package and "COM Extract at Build" property is set for the component. ClassA and ClassB are exposed in exactly identical manner by the component - there's an .rgs file for ea...

C++ linker issues

Hello there, I have this: a.cpp int localfunction () { return 1; } int local_symbol = localfunction(); b.cpp void thirdfunction () {}; main.cpp void main () { thirdfunction (); } When I compile this in a main executable everything works (even with optimizations), and the localfunction is executed at startup even if I don't ...

VC++-MFC : LoadLibrary returns invalid handle 0x10000000

Hi, I am unable to load my test.dll (in VC++ - MFC) using LoadLibrary() API. I get error code 126 (Module not found)using GetLastError(). By dependency walker I have come to know that my test.dll depends on "xerces-c_2_7.dll" and "Xalan-C_1_10.dll". These dlls were already present on the same path as the exe. Still I am getting the error...

crash when building with Visual Studio 2005 on Windows 7

I ran Visual Studio 2005 on Windows Vista (32-bit). I recently upgraded to Windows 7, and Visual C++ began crashing when building release executables. The actual crash is in mt.exe. I get the message, "mt.exe has stopped working". Is there a way to solve the crash, or do I need to upgrade to Visual Studio 2008? ...

error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

Please don't confuse with the title as it was already asked by someone but for a different context The below code in Visual C++ Compiler (VS2008) does not get compiles, instead it throws this exception: std::ifstream input (fileName); while (input) { string s; input >> s; cout << s << endl; }; But this code compiles fine in...

Develop seamlessly in both VC++ 2010 and VC++ 2008 on the same work ?

Hi, I'd like to synchronize a VC++ 2010 project with a VC++ 2008 one. Is it even possible ? Basically, if I'm adding/deleting/renaming a file to a project in VS2010, I'd like it to be added/deleted/renamed to the corresponding VS2008 project. Project options synchronization would be awesome too, but not necessary. I don't need a solutio...

[win32] can _open() return valid negative fd ?

Is it possible that win32's _open() return valid FD that is negative ? In other words, is comparison if( (fd=_open(...)) < 0) error...; as safe as form if( (fd=_open(...)) == -1) error...; ? I am asking because all msdn examples are in form if(fd == -1 ), and never form if( fd < 0). ...