visual-c++

RegRestoreKey problem

i want to do part of program which save and load some data from registry. Saving is succefuly working. I have function GrabPrivilage to grant some privilegies to my thread. i grant SE_RESTORE_NAME and SE_BACKUP_NAME to my thread and after that i call RegRestoreKey(HKEY_LOCAL_MACHINE, TEXT("C:\reg.txt"), REG_FORCE_RESTORE ); and it always...

BoundsChecker shows incorrect memory leak message

Hello All, I'm using BoundsChecker9.1 with visual c++. I have a class class Sample{ public: vector<AnotherClass> x; }; When I run my program the BoundsChecker tool reports all push_back() calls such as S.x.push_back(AnotherClass()) as memory leak.. Wouldn't all the elements in vector x will always be deallocated when the Sample clas...

How to debug an external library (OpenCV) in Visual C++?

I am developing a project in VC++2008. The project uses the OpenCV library (but I guess this applies to any other library). I am working with the Debug configuration, the linker properties include the debug versions of the library .lib's as additional dependencies. In VC++ Directories under Tools|Options i set up the include directory, t...

do you have to get rid of the WinMain to turn a project into a lib

say I built an application called App1 with a lot of classes in a single project. And I decide that I want to build another project called App2 and I want to use those same classes so I decide to turn App1 into a lib file. Must I remove the WinMain function to do so or can I leave it and the compiler will ignore the winMain in the lib fi...

why do game engines prefer static libraries over dynamic link libraries

I've been reading a few gaming books. And they always prefer to create the engine as a static library over dynamic link. I am new to c++ so I am not highly knowledge when it comes to static libraries and dynamic link libraries. All I know is static libraries increase the size of your program, where DLL link libraries are loaded as you ne...

How do virtual destructors work?

Few hours back I was fiddling with a Memory Leak issue and it turned out that I really got some basic stuff about virtual destructors wrong! Let me put explain my class design. class Base { virtual push_elements() {} }; class Derived:public Base { vector<int> x; public: void push_elements(){ for(int i=0;i <5;i++) ...

How to detect if the Windows DWORD_PTR type is supported, using an ifdef?

There are some new integer types in the Windows API to support Win64. They haven't always been suppoprted; e.g. they aren't present in MSVC6. How can I write an #if condition to detect if these types are supported by <windows.h>? (My code needs to compile under many different versions of Microsoft Visual C++, including MSVC6. So I ne...

Is Serialization of Objects threaded in Visual C++ 6.0?

Well, that's pretty much the question: Is Serialization of Objects threaded in Visual C++ 6.0? I've got a nasty bug that would be explained if this is the case, and I haven't found any documentation about it. ...

Link Error : xxx is already defined in *****.LIB :: What exactly is wrong?

Problem: I'm trying to use a library named DCMTK which used some other external libraries ( zlib, libtiff, libpng, libxml2, libiconv ). I've downloaded these external libraries (*.LIB & *.h files ) from the same website. Now, when I compile the DCMTK library I'm getting link errors (793 errors) like this: Error 2 error LNK2005: __e...

How do i get the screen to pause?

Possible Duplicate: How to stop C++ console application from exiting immediately? So im learning c++ and i was given this example and i wanted to run it. But i cannot get it to stay up, unless i change it. How do i get Microsoft visual 2010 to keep up the screen when it gets to the end of the program after I release it? #incl...

Getting a character and printing it in VC++

I have a problem getting a character from the user in VC++.the function i want to use uses the char format so when i get the input using getch() it gives me an error that can't convert 'int' to 'char'. could someone please help me how to get the input in char format please? edit: char key1[10]; key1=getch(); Main.draw_text(key1,120+(...

DVD writer sample needed in VC++

Hi, I am developing a new application which have to write data to DVD. Is it possible to do with IMAPI2. I read some help from MSDN but didnt get any startup material. Can u provide some nice sample or link. ...

OpenMP implementations in VC++ 2008, 2010

Depending on implementation, OMP can be quite useful to parallelize fairly arbitrary bits of code - e.g a parallel section inside a method that calls two independent methods - or it can be bad. It depends on how threads are created/cached, I think. How does the VC++ 2008 implementation work? And is the 2010 implementation significantly ...

error LNK2005: xxx already defined in MSVCRT.lib(MSVCR100.dll) C:\something\LIBCMT.lib(setlocal.obj)

Hello, I'm using DCMTK library for reading Dicom files (Image format used in medical image processing.) I'm having a problem in compiling this DCMTK source code. DCMTK uses some additional external libraries (zlib, tiff, libpng, libxml2, libiconv). I know that all libraries should be generated with same Code Generation Options. I've do...

Does the COM server have to call SysFreeString() for an [out] parameter?

We have the following interface: [object, uuid("uuidhere"), dual ] interface IInterface : IDispatch { [id(1), propget] HRESULT CoolProperty( [out, retval] BSTR* result ); } Now there's a minor problem. On one hand the parameter is "out" and so any value can be passed as input, the parameter will become valid only upon the successf...

can we get the penultimate exception that occurred from an mdmp or hdmp in windbg

Hi, I got a crash dump (both mdmp and hdmp) for my application (written in C++) captured using dr. watson. After analyzing the dumps through windbg, I concluded that the crash had occurred in the catch() itself :) What I need to know is what exception caused the the failure in the first place i.e. I need that penultimate(last but one...

what's the best way to consume an axis 1.3 web service using visual studio 2005 in c++

Hi I'm trying to consume an axis web service in VS 2005 & unmanaged c++.. The inbuilt sproxy.exe in VS falls over with a namespace error as the input/output namespaces are different.. though if I consume the web service in c# it works fine.. i've investigated gSOAP as well as Axis C++ both seem rather complex for what I need All the...

Windows Build System: How to build a project (from its source code) which doesn't have *.sln or Visual C++ proj file (*.vcproj)

I'm facing this problem. So, I need to build the support libraries (zlib, libtiff, libpng, libxml2, libiconv) with "Multithreaded DLL" (/MD) & "Multithreaded DLL Debug" (/MDd) run-time options. But the problem is there is no direct way . I mean there is no *.sln / *.vcproj file which I can open in Visual C++ and build it. I'm aware with...

LINK : fatal error LNK1104: cannot open file "Iphlpapi.lib"

So I'm using Visual C++ 6.0, and trying to compile some source code, but upon compilation I get this: Linking... LINK : fatal error LNK1104: cannot open file "Iphlpapi.lib" Error executing link.exe. I'm using the correct SDK, and the directories are correct. I've checked, double checked, and triple checked. The file is the specified d...

Update version in assemblyinfo.cs with the values defined in c++ header file

0 Hi! I have C++ project (VS2005) which includes header file with version number in #define directive. Now I need to include exactly the same number in twin C# project. What is the best way to do it? I'm thinking about including this file as a resource, then parse it at a runtime with regex to recover version number, but maybe there...