Re: How to return VB "Nothing"

From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 12/10/04


Date: Fri, 10 Dec 2004 12:45:56 -0800

That last advice is wrong. The fact that the garbage in the
passed in [out, retval] pointer is typically NULL does not
mean the component should not set it. If for example I am
the client, not VB, it may be true garbage, not NULL!
Failure to set the output argument on success can spell
a crash.

-- 
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Andrew Jarvis" <someone@somewhere> wrote in message 
news:uzKOphr3EHA.3908@TK2MSFTNGP12.phx.gbl...
> Nothing is the VB terminology for NULL.
>
> Just return NULL.
>
> If fact the pointer that VB will have created to receive the return value 
> will already be Nothing so you don't have to do anything.
>
> AJ
>
> "German" <german.koninin@crmDASHworldwideDOTnet> wrote in message 
> news:uMlWUUr3EHA.2788@TK2MSFTNGP15.phx.gbl...
>> Hi.
>>
>> I would like to return VB "Nothing" from my method of ATL ActiveX.
>> the return type of my method is LPDISPATCH. I have no idea how to do such
>> thing.
>> In VB it should looks like following.
>>
>> If myactivex.mymethod is Nothing Then
>>  BsgBox"Ok"
>> End If
>>
>> Thanks a lot.
>>
>>
>
> 


Relevant Pages

  • Re: Tutorial for CComPtr and CComQIPtr
    ... Apologies for confusing the topic with the mention of "garbage ... pointer" and the "Smart pointer". ... The template class Ptrimplements a garbage collecting pointer to any ... class derived from RefCount. ...
    (microsoft.public.vc.atl)
  • Re: portable finalizer
    ... finalization in SBCL, but I want to make my code portable. ... is a pointer to a C structure. ... so there is a destroy method: ... object destroyed when it is garbage collected. ...
    (comp.lang.lisp)
  • Re: Pass arguments with IDispatch.Invoke
    ... Microsoft MVP, MCSD ... I'm getting pointer to the structure from C, ... Alexander Nickolov wrote: ... The problem is a VARIANT does ...
    (microsoft.public.vc.atl)
  • Re: How to casting to VARIANT*
    ... Microsoft MVP, MCSD ... but I wonder why MSWORD is designed this way. ... > in there that just take a plain VARIANT. ... > optional are also passed by pointer. ...
    (microsoft.public.vc.atl)
  • Re: Arithmetic on function address
    ... The Standard permits you to cast a pointer ... garbage out" is the rule that applies here. ... You mean that on this compiler, ...
    (comp.lang.c)