How to use VARIANT??

M

Mark Williams

Hi all,

Im being supplied data from shared memory in the format of VARIANT's.

Ive been searching through MSDN and Google for quite a long time now
and i cannot find how these should be used in C++ (MS VisualStudio
V8.0).

Are there macros that are used to handle values, types, etc?
Also, how do i handle (and test for) NAN/QNAN values?

Thanks in advance.
 
J

Jochen Kalmbach [MVP]

Hi Mark!
Im being supplied data from shared memory in the format of VARIANT's.

Hm... you can't use VARIANT in shared memory... it sometimes contains
pointers to some memory from the process who allocated the VARIANT...

So it is a bad idea to use VARIANT in a shared-memory-situation.
Ive been searching through MSDN and Google for quite a long time now
and i cannot find how these should be used in C++ (MS VisualStudio
V8.0).

See: Variant Manipulation Functions
http://windowssdk.msdn.microsoft.com/en-us/library/ms221673.aspx
Are there macros that are used to handle values, types, etc?

V_xx macros...
Also, how do i handle (and test for) NAN/QNAN values?

As always... in V_R4/R8

Greetings
Jochen
 
M

Mark Williams

Ok, that cleared up a few things.
As always... in V_R4/R8

Ok, V_R8 returns the value "1.#QNAN00000000000" as shown in the VS
debugger.
How do i test for this? What would an if statement look like?

ie:
if (V_R8(&v) == ????) {blah}

Thanks again.
 
J

Jeff F

Mark Williams said:
Ok, that cleared up a few things.


Ok, V_R8 returns the value "1.#QNAN00000000000" as shown in the VS
debugger.
How do i test for this? What would an if statement look like?

ie:
if (V_R8(&v) == ????) {blah}

if (V_R8(&v) != V_R8(&v)) {blah}

is the C++ standard way to detect NAN, assuming that V_R8 returns a double.

Jeff Flinn
 
J

Jochen Kalmbach [MVP]

Hi Mark!
Ok, that cleared up a few things.


Ok, V_R8 returns the value "1.#QNAN00000000000" as shown in the VS
debugger.
How do i test for this? What would an if statement look like?

ie:
if (V_R8(&v) == ????) {blah}

_isnan


Greetings
Jochen
 
P

Phlip

Mark said:
Ok, V_R8 returns the value "1.#QNAN00000000000" as shown in the VS
debugger.
How do i test for this? What would an if statement look like?

ie:
if (V_R8(&v) == ????) {blah}

Someone has doubtless told you VARIANT is off-topic here.

"Off-topic" means we are only qualified to give the Standard C++ answer. So
if there were such an answer for a NAN, we might tell you a method
incompatible with Win32 and its VARIANT type.

Try either an OLE newsgroup, or for the
best possible answer here.
 
R

red floyd

Mark said:
Hi all,

Im being supplied data from shared memory in the format of VARIANT's.

Ive been searching through MSDN and Google for quite a long time now
and i cannot find how these should be used in C++ (MS VisualStudio
V8.0).

Are there macros that are used to handle values, types, etc?
Also, how do i handle (and test for) NAN/QNAN values?

Thanks in advance.

What is a VARIANT? Standard C++ doesn't define it.

You might want to try a newsgroup with "microsoft" or "windows" in its name.
 
R

red floyd

Phlip said:
C++ Programmers should generally know that pattern; don't play dumb. ;-)

He's not asking about a pattern, he's asking about an MS-specific data
type. I told him it was OT and to try an MS newsgroup instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top