visual-c++

Reuse Edit Control as Command Window

This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such: Name of favorite porn star: The user should be able to enter text after the prompt like such: Name of favorite porn star: Raven Riley But I need to prevent the user from moving the cursor into the prompt area. Use...

Creating a ruler bar in MFC

What's the best way to go about creating a vertical and horizontal ruler bars in an SDI app? Would you make it part of the frame or the view? Derive it from CControlBar, or is there a better method? The vertical ruler must also be docked to a pane and not the frame. To make it a little clearer as to what I'm after, imagine the vertic...

VC++ 2008, OpenProcess always returning error 5 (Access Denied)

Would anyone know why MSVC++ 2008 always returns error 5 on GetLastError() when I try to call OpenProcess with PROCESS_ALL_ACCESS as my desired access? PROCESS_VM_READ works just fine. I'm an administrator on this computer and it is working fine in Dev C++. Do I need to set an option somewhere? ...

C++ include and import difference

What is the difference between include and import in C++? ...

In Microsoft Visual Studio 2005 is it possible to set the size of an edit window when opened?

I have a very large monitor. When I open a text file in MSVC, the file defaults to a width of about 80% of my screen space. For most bits of code that's about twice the size I need. Is there a way to set the default size of a newly opened file? ...

Attaching a DLL to debug?

I have a DLL as an add-in in a third party application. When I launch the DLL from MS Visual Studio 2005 in debug mode the third party application will crash. Instead of launching my DLL from Visual Studio in debug mode, I try to launch the third party application first which will load my DLL. Then I attach my DLL to the third party app...

MinGW library converted to Windows library gives odd link in VC++6

I used the MinGW .a to Windows .lib transformation process as detailed in a thread on the gmp-discuss list, as below (acting against a library created with --disable-shared --enable-static.) cp libgmp.a gmp.a ranlib gmp.a mv gmp.a gmp.lib I now have a .lib file against which VC++6 seems to have no difficulty linking. What concerns me...

Visual C++ Redistributables without using VCRedist_x86.exe

I'm developing in an environment that is severely constrained, but the developers also have tight control over. VCRedist_x86.exe - A 4Mb redistributable - is no fun (four hours to transfer). I'd really prefer to just redistribute MFC90.dll, msvcm90.dll, msvcp90.dll and msvcr90.dll - that's more like 2Mb. However, Redistributing Visu...

How to determine optimal thread stack size?

Actually, two sizes: initially committed and total reserved. Do you use static or dynamic analysis? Which tools? Which techniques? ...

How do I increase the allowed decorated name length in VC9 (MSVC 2008)?

I have a rather large and complex set of programs to port from VC8 to VC9. One of the modules has a number of layered typedefs, which cause the compiler to generate a C4503 warning (decorated name truncated). The generated LIB file will not properly link to other modules in the project. VC8 had no trouble with this, leading me to conclud...

Unmanaged vc++ static libraries and C# GUI app

Basically I have a bunch of unmanaged VC++ static libraries. And the VC++ GUI application which uses those and it is based on MFC. The goal is to replace the GUI app with the one done in C# instead but using all the same static libraries. The question is if this even possible, and if yes, then what is the right way to accomplish that? ...

Adding floats with gmp gives "correct" results, sort of ...

In the code below I use mpf_add to add the string representation of two floating values. What I don't understand at this point is why 2.2 + 3.2 = 5.39999999999999999999999999999999999999. I would have thought that gmp was smart enough to give 5.4. What am I not comprehending about how gmp does floats? (BTW, when I first wrote this I w...

Excel SheetSelectionChange event example needed. C++

I have a problem I'm trying to solve involving interfaceing a C++ program with Excel (an import interface, specifically). The SheetSelectionChange sounds like it will get me most of the way to where I need to be, but I can't find any good documentation or examples on registering the event, using its Range parameter when it's fired, and ...

Why can't I debug my asp.net web app

When I add a breakpoint and hit F5 to run in the debugger (I am using my debug build), a dialog pops up telling my my web.config file does not have debug=true in it (which is does) and I get 2 choices a) run without the debugger or b) let visual studio update my web.config file. If I choose b) the web.config is updated badly and nothing ...

Visual C++ unresolved external symbol (can't find one of my own functions)

This is a very basic problem that's frustrating me at the moment. Let's say within a single solution, I have two projects. Let's call the first project SimpleMath. It has one header file "Add.h" which has int add(int i, int j) and the implementation "Add.cpp" which has int add(int i, int j) { return i+j; } Now let's say in a sec...

Do I need to protect read access to an STL container in a multithreading environment?

I have one std::list<> container and these threads: One writer thread which adds elements indefinitely. One reader/writer thread which reads and removes elements while available. Several reader threads which access the SIZE of the container (by using the size() method) There is a normal mutex which protects the access to the list fro...

How to assign keyboard shortcut to Source Control commands in Visual Studio 2008?

I use Visual C++ 2008 in Visual Studio 2008. I frequently use the following command to diff an open file against its most recent checked-in version: File | Source Control | Compare... I can also do the same thing by clicking on an icon in the Source Control toolbar. I'm not certain, but I believe this command is the same for any sou...

Building windows c++ libraries without a runtime?

I'm trying to create a c++ library for use on windows/MSVC. My problem is that it seems that in order to link properly, I need to distribute a bunch of different versions, linked against different versions of MSVC's c++ runtimes - single and multi-threaded, debug and release, different compiler versions, various other security and other...

What are some convincing arguments to upgrade from Visual Studio 6?

I have a client who is still using Visual Studio 6 for building production systems. They write multi-threaded systems that use STL and run on mutli-processor machines. Occasionally when they change the spec of or increase the load on one of their server machines they get 'weird' difficult to reproduce errors... I know that there are ...

Why doesn't WD Velociraptor speed up my VC++-compilation significantly?

Several people round here recommended switching to the new WD Velociraptor 10000rpm harddisk. Also magazine articles praise the performance. I bought one and mirrored my old system to it. The resulting increase in compilation-speed is somewhat disappointing: On my old Samsung drive (SATA, 7200), the compilation time was 16:02. On the ...