visual-c++

How portable is code using wmemset()?

Currently our code uses a for-loop for filling a buffer holding a Unicode string with some Unicode character value (of type wchar_t). There's wmemset() function in Visual C++ using which we could replace a loop with a single function call in that code. However we're concerned about portability - we'd like to leave code as portable as pos...

How to create overloading functions in Visual-C++ library (.net) ?

So what I want is to create 3 functions with same names but taking difrent arguments (one will take 2 and others one lats say System::String). (I will compile tham into .net library from visual-C++, create a c# project, connect my lib to it and want to be able to see in my library one function name which would have 3 overloads.) How to ...

Comparing pointers fails mystically in VC++

I have a tree structure and I want to find all nodes matching a given criteria. Each time I call the find function, it returns next matching node. Children are searched by recursive function call. For some reason a key comparison of pointers fails for this implementation. Please see the code below, I have pointed out the failing compari...

Casting int as float

Hello all. I am trying to add an int to a float. My code is: int main() { char paus[2]; int millit = 5085840; float dmillit = .000005; float dbuffer; printf("(float)milit + dmillit: %f\n",(float)millit + dmillit); dbuffer = (float)millit + dmillit; printf("dbuffer: %f\n",dbuffer); fgets(paus,2,stdin); retu...

Converting Makefiles to MsBuild

I would like to know if there is good practices, good tools to move a bunch of windows makefile projects to some msbuid (VS 2010) format? If you think that' not a good idea to make it using a tool, maybe you do know something like a dependency analyser to make a checklist? ...

Where can I get Visual C++ 6.0?

I have a project that was allegedly working when compiled with Visual C++ 6.0. Where can I get Visual C++ 6.0, so I can add one more feature (hopefuly a relatively small change) and recompile? (There doesn't seem to be a good reason right now for "Migrating a big project in MFC from Visual C++ 6.0 to Visual Studio 2005" or "a total rewr...

Uninitialized C++ structure on different operating systems

Hi , We have application which is written in VC++ using Visual studio 2005, that supports multiple opertaing systems like Windows XP, Windows 2008, Windows 2003. Most of the time the Server part of the application gets installed on Windows 2003 / Windows 2008 and Client part gets installed on Windows XP. Client and Server communicate th...

mfc42u.dll Error while migrating from VC6 to VS2005

I have migrated my VC6 application to VS2005, all my code got compiled with some changes and there is no compilation error. But I am getting a linking error LNK1104. LINK : fatal error LNK1104: cannot open file 'mfc42u.lib' I have imported the dsw of VC6 in Visual Studio 2005, not sure from where it is still referring to the mfc42u.lib ...

Can we create a VC++ executable which will work natively on both 32 bit and 64 bit Windows?

Is there any way to build a VC++ project so that the dll/exe created by it will work as a 32 bit application on a 32 bit Windows OS and as a 64 bit application on a 64 bit Windows OS (not in WOW64). I know that is possible for C# applications using the /ANYCPU option. ...

How to access a global variable from a worker thread

I have a vc++ 2005 dialog based application, where I use a worker thread to do some background processing. The worker thread is implemented as a global function in the dialog class I am able to access the variables of the dialog class inside the worker thread but I am not able to get some of their their values correctly inside the wor...

Data access synchronization between multiple threads.

Hi, I'm trying to implement a multi threaded, recursive file search logic in Visual C++. The logic is as follows: Threads 1,2 will start at a directory location and match the files present in the directory with the search criteria. If they find a child directory, they will add it to a work Queue. Once a thread finishes with the files in...

stream << set_of_dices.dies[die].getStringRow(row) << " ";

Hi, I get the following error when I try to run my application in Visual Studio 2010: Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion) new folder\setofdices.cpp 55 1 test1 And the function is: //Overload of the ope...

C++ Weird Diamond inheritance issue

I have this A / \ B C \ / D A has a pure virtual function, prototyped as: virtual A* clone(void) const = 0; B and C virtually inherit from A ( class B: public virtual A, class C: public virtual A) B has the virtual function, prototyped as: virtual B* clone(void) const {}; C has the virtual function, protot...

VC++ thread marshalling and COM : The application called an interface that was marshalled for a different thread

Hi, My VC++ 2005 Dialog based application initializes a COM object in the dialog class and uses it in the worker thread. I called CoInitialize(NULL) At the start of the application and the at the start of the worker thread. But when a COM method is called the error "The application called an interface that was marshalled for a differe...

Is it possible to extend function from library in such case?

I have a .Net library. say with 2 public functions. say one is Summmator which takes 2 arguments and does A+B. Another function simpleMultiplicator which takes 2 arguments: a number to multiplicate and count of times it should be multiplicated. A simpleMultiplicator function when called uses Summmator function. So it is my library. It is...

Why is where highlighted?

In VS 2010 C++ when I type where it gets highlighted, why? It is not a keyword so what's the reason? Thanks. ...

GLUT Matrix multiplication to rotate an object in its own axis without using glRotate

*I say rotating an object on its own axis but I think my term is wrong...what I mean by that is like rotating my object from the objects center and not at the origin I'm trying to make a program that rotates my object(made by using a matrix of points/vertices) in its *own axis without the use of glRotate or glTranslate What I did was to...

How to add icon to IE imagelist?

How can I add up some more icons in the IE's toolbar imagelist? ...

Steps in visual c++ to start a toolbar button project

Hi, I would like to start a new VC++ project that can create a toolbar button for Internet Explorer in the form of DLL. Yes, I know there are complete source code example at Code Project. But the example are already created/generated by the original developer. So I lack the knowledge on how actually to start a new project like that. W...

Visual C++: How is checked_array_iterator useful?

On compiling code at Warning Level 4 (/W4), I get C4996 warnings on std::copy() calls whose parameters are C arrays (not STL containers like vectors). The recommended solution to fix this seems to be to use stdext::checked_array_iterator. What is the use of stdext::checked_array_iterator? How does it work? Why does it not give any comp...