Click here to Skip to main content
15,922,427 members
Home / Discussions / COM
   

COM

 
QuestionVARIANT_BOOL return value in Automation class Pin
User 2155979-Jan-07 5:07
User 2155979-Jan-07 5:07 
AnswerRe: VARIANT_BOOL return value in Automation class Pin
Roger Stoltz9-Jan-07 5:45
Roger Stoltz9-Jan-07 5:45 
QuestionRe: VARIANT_BOOL return value in Automation class [modified] Pin
User 2155979-Jan-07 5:52
User 2155979-Jan-07 5:52 
AnswerRe: VARIANT_BOOL return value in Automation class Pin
Roger Stoltz9-Jan-07 21:18
Roger Stoltz9-Jan-07 21:18 
QuestionRe: VARIANT_BOOL return value in Automation class Pin
User 21559710-Jan-07 0:26
User 21559710-Jan-07 0:26 
AnswerRe: VARIANT_BOOL return value in Automation class Pin
Roger Stoltz10-Jan-07 2:42
Roger Stoltz10-Jan-07 2:42 
GeneralRe: VARIANT_BOOL return value in Automation class Pin
User 21559711-Jan-07 0:03
User 21559711-Jan-07 0:03 
GeneralRe: VARIANT_BOOL return value in Automation class Pin
Roger Stoltz11-Jan-07 0:46
Roger Stoltz11-Jan-07 0:46 
Sohail Kadiwala wrote:
VARIANT_FALSE and FALSE and false are all "0" so when I return VARIANT_FALSE the return value should be 0 and not 1 Any thoughts on this?


Well, this is what I want you to verify immediately after the call has returned.
As read even in the forum discussion the thing is when you return a VARIANT_FALSE, which is defined as a 16-bit wide zero, it may be interpreted as 32-bit wide BOOL type. Infact those are not passed 'by value', they're passed as pointers. I think the following will demonstrate the problem:
short* pwValue = new short;
*pwValue = 0;
long* pdwMoreValue = (long*)pwValue; //This is what happens behind the scenes

// A statement like the one below is totally unreliable because
// the upper 16 bit have never been initialized
if( *pdwMoreValue )
{
    ....
}

My point is that your variable may contain zeros in the lower 16 bits, which would match VARIANT_FALSE, but the upper 16 bits may contain garbage. I want you to find out if this is the case as step #1.

--
Rog


"It's supposed to be hard, otherwise anybody could do it!" - selfquote

"No one remembers a coward!" - Jan Elfström 1998
"...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above

GeneralRe: VARIANT_BOOL return value in Automation class [modified] Pin
User 21559711-Jan-07 5:03
User 21559711-Jan-07 5:03 
AnswerRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
User 21559711-Jan-07 6:07
User 21559711-Jan-07 6:07 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
Roger Stoltz11-Jan-07 22:45
Roger Stoltz11-Jan-07 22:45 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
User 21559712-Jan-07 0:50
User 21559712-Jan-07 0:50 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
Roger Stoltz12-Jan-07 1:50
Roger Stoltz12-Jan-07 1:50 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
User 21559712-Jan-07 4:11
User 21559712-Jan-07 4:11 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
Roger Stoltz12-Jan-07 4:40
Roger Stoltz12-Jan-07 4:40 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
User 21559712-Jan-07 5:24
User 21559712-Jan-07 5:24 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
Roger Stoltz12-Jan-07 5:37
Roger Stoltz12-Jan-07 5:37 
GeneralRe: [SOLVED] VARIANT_BOOL return value in Automation class Pin
User 21559714-Jan-07 7:50
User 21559714-Jan-07 7:50 
QuestionCOM and windows service application ... Pin
Sakthiu9-Jan-07 0:31
Sakthiu9-Jan-07 0:31 
QuestionHow can get information from web page ? Pin
ankprasanna9-Jan-07 0:22
ankprasanna9-Jan-07 0:22 
QuestionCOM dll internals. Pin
HakunaMatada8-Jan-07 19:21
HakunaMatada8-Jan-07 19:21 
AnswerRe: COM dll internals. Pin
Phil Harding15-Jan-07 3:45
Phil Harding15-Jan-07 3:45 
QuestionSystem monitor using WMI Pin
abhiramsss8-Jan-07 12:26
abhiramsss8-Jan-07 12:26 
QuestionCOM on Linux? Pin
Josh Smith8-Jan-07 10:27
Josh Smith8-Jan-07 10:27 
AnswerRe: COM on Linux? Pin
Christian Graus8-Jan-07 11:22
protectorChristian Graus8-Jan-07 11:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.