visual-c++

Compare sign of two doubles

What's the fastest way to compare sign on a double? I know that a double has a "sign bit" but I'm not sure if the way I'm "looking for it" in its binary rep is a good idea or not. Barring "portability" issues, can someone tell me what's going on with this code in MSVC++? #include <stdio.h> int main() { double z = 5.0 ; __int64 b...

Write data into .txt file created by CFileDialog, in C++

I wanna Write data into .txt file created by CFileDialog, in C++. The problem I am facing is that below codes doesn't work, although there is no build error. The .txt file created by CFileDialog can not be found for some reason. What's wrong the code? what's the efficient way to Write data into .txt file created by CFileDialog, in C++?...

VC++: Help to create a simple COM class

Hello guys! Can someone guide me on how to create a simple COM class with VC++ that I can have it called by a VB6 app with CreateObject? Thanks! ...

C++ Microsoft SAPI: How to set Windows text-to-speech output to a memory buffer?

Hi all, I have been trying to figure out how to "speak" a text into a memory buffer using Windows SAPI 5.1 but so far no success, even though it seems it should be quite simple. There is an example of streaming the synthesized speech into a .wav file, but no examples of how to stream it to a memory buffer. In the end I need to have t...

How to read _popen directly without piping it to file?

How can I write the output of this line of code to a float variable instead of piping it to a file? The output of this line is a floating number. FILE *child = _popen("java -jar c:\\simmetrics.jar c:\\chtml.txt c:\\thtml.txt", "r"); ...

Problem with inner classes of the same name in Visual C++

I have a problem with Visual C++ 2005, where apparently inner classes with the same name but in different outer classes are confused. The problem occurs for two layers, where each layer has a listener interface as an inner class. B is a listener of A, and has its own listener in a third layer above it (not shown). The structure of the ...

"One or more breakpoints cannot be set and have been disabled. Execution will stop at the beginning of the program."

I set a breakpoint in my code in Visual-C++, but when I run, I see the error mentioned in the title. I know this question has been asked before on Stack Overflow (http://stackoverflow.com/questions/657470/breakpoints-cannot-be-set-and-have-been-disabled-problem), but none of the answers there fully explained the problem I'm seeing. The ...

how to see complete string or character array in the watch window in vc++ ?

Hi, I am working on Visual Studio 2009. While debugging, I need to see the values of the variables in the watch window of visual studio.By default, it shows only the first character. It's only after I add a "s" or "su"(for unicode) that I see the complete content. Is there any setting in visual studio that I can make, so that this values...

std::make_shared as a default argument does not compile

In Visual C++ (2008 and 2010), the following code does not compile with the following error: #include <memory> void Foo( std::shared_ptr< int > test = ::std::make_shared< int >( 5 ) ) { } class P { void Foo( std::shared_ptr< int > test = ::std::make_shared< int >( 5 ) ) { } }; error C2039: 'make_shared' : is not a...

A Program that sits in the Notification Area

Hello, Thanks for taking the time to read my question. If I build a program, how can I get it to hide in the notifications area(windows 7, cant remember what it's called in XP or Vista) when I minimize it? Like say a Torrent program, or a AntiVirus program. Also I'd like to know, how can I hide it from the notifications area and brin...

How to determine at runtime when your C++ application has the visual studio debugger attached?

How do you determine at runtime whether the visual studio debugger is attached to your process. I've seen instructions for how to do this in .NET, but my process is a native C++ process. Support for detecting Just-in-time debugging would be nice but not a strict requirement. ...

Problem calling std::max

I compiled my bison-generated files in Visual Studio and got these errors: ...\position.hh(83): error C2589: '(' : illegal token on right side of '::' ...\position.hh(83): error C2059: syntax error : '::' ...\position.hh(83): error C2589: '(' : illegal token on right side of '::' ...\position.hh(83): error C2059: syntax error :...

initializer_list not working in VC10

hi i wrote this program in VC++ 2010: class class1 { public: class1 (initializer_list<int> a){}; int foo; float Bar; }; void main() { class1 c = {2,3}; getchar(); } but i get this errors when i compile project: Error 1 error C2552: 'c' : non-aggregates cannot be initialized with initializer list c:\users\pswin\documents...

the problem of "cvEigenVV"

Hi!When I compile the program,VC2005 always tell :"error C2198: 'cvEigenVV' : too few arguments for call". Part of the code below: void draw_oxfd_feature( IplImage* img, struct feature* feat, CvScalar color ) { double m[4] = { feat->a, feat->b, feat->b, feat->c }; double v[4] = { 0 }; double e[2] = { 0 }; CvMat M; CvMat V; CvMat ...

How would I access the Windows Login (Authentication) API from a C++ Service Application?

Let us imagine for a moment that I have a piece of hardware that can act as an authentication for a user on a given system. I want to write an application in C++ to run as a service, look for this device and if found log the appropriate user in. I believe I have found the API's I would need to use to perform the hardware and service port...

unistd.h related problem when compiling bison & flex program under vc++

I'm using bison & flex (downloaded via cygwin) with vc++. When I compile the program I got an error: ...: fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory The corresponding code in the flex-generated file is: #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it w...

protected access specifiers in singleton class

HI, In singleton class we are declaring constructors as private. Is it possible to give as protected. If giving as protected is it beneficial. Whats the advantage or disadvantage of private over protected ...

Disabling Remote-Debugging Connection on Windows 2000

I have two machines one running Win 2000 and one running Win XP both with VSC++ 6. I created an application using MFC on the Win XP machine (local) and successfully used the Win2000 machine (remote) as the target for debugging. The code was in a shared drive on the Win2000 machine. This setup worked well, just like in the movies! How...

How union is used to define a class

Hi, I have two doubts, please help me on this: Is it possible to define a class inside union Is it possible to define a class without class name ...

Portability of pthreads-win32 over various compilers.

Hello, I'm using pthreads-win32 to allow threading support for windows. I have a cross platform project that uses pthreads and I want to make it work on windows with various compilers and different OS versions. At least, according to the documentation pthreads-win32 should work with MSVC and even MSVC builds provided. But I don't kno...