c++

does not name a type error in C++

Hi, I have two classes declared as below: class User { public: MyMessageBox dataMsgBox; }; class MyMessageBox { public: void sendMessage(Message *msg, User *recvr); Message receiveMessage(); vector<Message> *dataMessageList; }; When I try to compile it using gcc, it gives the following error: 'MyMessageBox does not name a type'....

Problem with WNetGetUniversalName

Hello, I have a strange problem with some code that calls WNetGetUniversalName. When I call the function I always get error 67 (ERROR_BAD_NET_NAME). But the network connection really does exist. So from the scratch. I'm writing a Windows shell extension that shall do some stuff with text files that are located on a specified network driv...

Implementing IEnumerable<T> in C++/CLI

I'm having problems implementing IEnumerable<T> in my custom collection class in C++/CLI. Here is the relevant part of the code: using namespace System::Collections::Generic; ref class MyCollection : IEnumerable<MyClass^> { public: MyCollection() { } virtual IEnumerator<MyClass^>^ GetEnumerator() { return...

WIX C++ Custom Action

Hi, I have a basic WIX custom action: UINT __stdcall MyCustomAction(MSIHANDLE hInstaller) { DWORD dwSize=0; MsiGetProperty(hInstaller, TEXT("MyProperty"), TEXT(""), &dwSize); return ERROR_SUCCESS; } Added to the installer: <CustomAction Id="CustomActionId" FileKey="Cu...

What is a C++ library with an ECDiffieHellmanCng-compatible implementation?

I'm looking for a key exchange solution between a .NET app and an embedded device. The two endpoints have a shared secret key, making the Elliptic Curve Diffie-Hellman (ECDH) algorithm excellent for securely exchanging a master secret for the session. There is a good C++ library, crypto++, which implements ECDH and is suitable for the e...

Can a class method be both inline and static?

Does it even make sense? ...

Spectrogram C++ library

Hi For my current project in C++ / Qt I need a library (LGPL is preferred) which can calculate a spectrogram from a signal ( basically an array of doubles ). I already use Qwt for the GUI part. Any suggestions? Thanks. ...

generation vs verification

hi, i was wondering if i am generating a number give an input and i want to then verify that the pairs are valid..would I store the result somewhere? I am not inclined to since I could run a million inputs through. Perhaps in my verification function I just call the generation function which generates the random code for a given input ...

Convert float to bigint (aka portable way to get binary exponent & mantissa)

In C++, I have a bigint class that can hold an integer of arbitrary size. I'd like to convert large float or double numbers to bigint. I have a working method, but it's a bit of a hack. I used IEEE 754 number specification to get the binary sign, mantissa and exponent of the input number. Here is the code (Sign is ignored here, that's...

C++/CLI : Interop window is not properly configured

Hi, I'm trying to load a WPF control in a C++/CLI application, using the HwndSource class. Here is my code : UBOOL MyWindowWrapper::Init(const HWND InParentWindowHandle) { Interop::HwndSourceParameters sourceParams( "WindowName" ); sourceParams.PositionX = 0; sourceParams.PositionY = 0; sourceParams.ParentWindow = (Int...

C++ Design pattern for Search and Replace

Hi I have big paragraph with some special characters as %1 , %2, %3 I need to know if there is any design pattern to replace those with proper values and create final paragraph. For Example: Following is my static paragraph. %1 is beautiful country , %2 is the capital of %1, %1 national language is %3. I get values of %1,%2, %3 by so...

Are multiline tooltips possible using CWnd::EnableTooltips()?

I'm attempting to make my tooltips multiline, but I don't seem to be having much luck with it. I call CWnd::EnableTooltips() directly after creation (in this case, an edit box) and I handle the TTN_NEEDTEXT message. My tooltips display correctly, but only display as a single line. I've tried adding '\n' to the string I pass when han...

The C `clock()` function just returns a zero

The C clock() function just returns me a zero. I tried using different types, with no improvement... Is this a good way to measure time with good precision? #include <time.h> #include <stdio.h> int main() { clock_t start, end; double cpu_time_used; char s[32]; start = clock(); printf("\nSleeping 3 seconds...\n\n"...

How to use ETW from a C++ windows client

I'm researching Event Tracing for Windows (ETW) to allow a user-mode windows client to write out tracing information. The existing documentation is, to put it lightly, insanely incomplete. What would really help is a simple C++ example that writes out tracing messages using ETW. Does such an example exist? Is there other ETW documentatio...

Create an interactive logon session

I'm trying to create a utility similar to Microsoft's abandoned Super Fast User Switcher (download), which allows fast user switching without going through the Welcome screen. I have a working implementation using the undocumented WinStationConnectW API (along with WTSEnumerateSessions), but it can only switch to a user who is already l...

what is that mean reinterpret_cast<char *&>(a) = cp;

Yes this is not very portable, I wonder why one would want to do something like this:` char *cp ; reinterpret_cast<char *&>(a) = cp; ` and what it means? Thx ...

Unittest++: test for multiple possible values

Hi there, i am currently implementing a simple ray tracer in c++. I have a class named OrthonormalBasis, which generates three orthogonal unit vectors from one or two specified vectors, for example: void OrthonormalBasis::init_from_u ( const Vector& u ) { Vector n(1,0,0); Vector m(0,1,0); u_ = unify(u); v_ = cross(u_,n)...

What Linux library supports sockets, ioctl calls, tuntap, etc...?

What is the name of the runtime library which implements Linux network interfaces, like sockets, tuntaps, netlink, etc...? For example when I create an UDP socket and make an ioctl call to fetch network interface info, which library actually implements that call? What are the corresponding *.so files on most linux dstirbutions? ...

Why can't I put a "using" declaration inside a class declaration?

I understand the troubles you can get into when you put a using declaration inside a header file, so I don't want to do that. Instead I tried to put the using (or a namespace foo =) within the class declaration, to cut down on repetitive typing within the header file. Unfortunately I get compiler errors. Seems like it would be a usefu...

Which overloaded version of operator will be called

Suppose i have declared subscript operators in a class char& operator[] (int index); const char operator[](int index) const; In what condition the second overload is called. Is it only called through a const object. In the following scenarios which version of operator will be called. const char res1 = nonConstObject[10]; nonCons...