dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: what is ANY ?

  1. #16
    Mark Alexander Bertenshaw Guest

    Re: what is ANY ?


    bob -

    Thanks for the explanation. It's a shame that you can't pass a UDT byval
    - that would give us a lot of flexibility. Having said that, I am sure that
    if I read the Curland book properly, it would be mentioned there.

    -------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK

    "bob butler" <butlerbob@my-Deja.com> wrote:
    >Mark Alexander Bertenshaw <mark.bertenshaw@virgin.net> wrote in message
    >news:39d54d56@news.devx.com...
    >> Bob -
    >>
    >> When using my imaginary declare:
    >>
    >> Private Declare Function MYThang Lib "oojah" (ByVal Value As Any) As Long
    >>
    >> I cannot set pass anything other than String via the Value parameter.

    Are
    >> you sure this isn't its only use?

    >
    >With "ByVal Value As Any" you can pass a long (which puts the actual value
    >on the stack) or a string (which puts the address of the ascii version of
    >the string on the stack). Since the stack is composed of 32-bit integers
    >the value you pass has to match that type even though you say "as any".

    Use
    >CLng to pass a 16-bit integer or other numeric types.
    >
    >If you made it "ByRef Value As Any" then you could use any VB type since
    >only the address of the value would be put on the stack for the call.
    >Addresses are all 32-bit integers so they all fit. Of course, for a String
    >that means you send the address of the BSTR version and most API calls do
    >not work correctly with them.
    >
    >
    >
    >



  2. #17
    Mark Alexander Bertenshaw Guest

    Re: what is ANY ?


    bob -

    Thanks for the explanation. It's a shame that you can't pass a UDT byval
    - that would give us a lot of flexibility. Having said that, I am sure that
    if I read the Curland book properly, it would be mentioned there.

    -------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK

    "bob butler" <butlerbob@my-Deja.com> wrote:
    >Mark Alexander Bertenshaw <mark.bertenshaw@virgin.net> wrote in message
    >news:39d54d56@news.devx.com...
    >> Bob -
    >>
    >> When using my imaginary declare:
    >>
    >> Private Declare Function MYThang Lib "oojah" (ByVal Value As Any) As Long
    >>
    >> I cannot set pass anything other than String via the Value parameter.

    Are
    >> you sure this isn't its only use?

    >
    >With "ByVal Value As Any" you can pass a long (which puts the actual value
    >on the stack) or a string (which puts the address of the ascii version of
    >the string on the stack). Since the stack is composed of 32-bit integers
    >the value you pass has to match that type even though you say "as any".

    Use
    >CLng to pass a 16-bit integer or other numeric types.
    >
    >If you made it "ByRef Value As Any" then you could use any VB type since
    >only the address of the value would be put on the stack for the call.
    >Addresses are all 32-bit integers so they all fit. Of course, for a String
    >that means you send the address of the BSTR version and most API calls do
    >not work correctly with them.
    >
    >
    >
    >



  3. #18
    Guest

    Re: what is ANY ?

    Thanks, everyone, for the very informative responses.


    "bob butler" <butlerbob@my-Deja.com> wrote in message
    news:39d5fb54@news.devx.com...
    > Mark Alexander Bertenshaw <mark.bertenshaw@virgin.net> wrote in message
    > news:39d54d56@news.devx.com...
    > > Bob -
    > >
    > > When using my imaginary declare:
    > >
    > > Private Declare Function MYThang Lib "oojah" (ByVal Value As Any) As

    Long
    > >
    > > I cannot set pass anything other than String via the Value parameter.

    Are
    > > you sure this isn't its only use?

    >
    > With "ByVal Value As Any" you can pass a long (which puts the actual value
    > on the stack) or a string (which puts the address of the ascii version of
    > the string on the stack). Since the stack is composed of 32-bit integers
    > the value you pass has to match that type even though you say "as any".

    Use
    > CLng to pass a 16-bit integer or other numeric types.
    >
    > If you made it "ByRef Value As Any" then you could use any VB type since
    > only the address of the value would be put on the stack for the call.
    > Addresses are all 32-bit integers so they all fit. Of course, for a

    String
    > that means you send the address of the BSTR version and most API calls do
    > not work correctly with them.
    >
    >
    >
    >




  4. #19
    Guest

    Re: what is ANY ?

    Thanks, everyone, for the very informative responses.


    "bob butler" <butlerbob@my-Deja.com> wrote in message
    news:39d5fb54@news.devx.com...
    > Mark Alexander Bertenshaw <mark.bertenshaw@virgin.net> wrote in message
    > news:39d54d56@news.devx.com...
    > > Bob -
    > >
    > > When using my imaginary declare:
    > >
    > > Private Declare Function MYThang Lib "oojah" (ByVal Value As Any) As

    Long
    > >
    > > I cannot set pass anything other than String via the Value parameter.

    Are
    > > you sure this isn't its only use?

    >
    > With "ByVal Value As Any" you can pass a long (which puts the actual value
    > on the stack) or a string (which puts the address of the ascii version of
    > the string on the stack). Since the stack is composed of 32-bit integers
    > the value you pass has to match that type even though you say "as any".

    Use
    > CLng to pass a 16-bit integer or other numeric types.
    >
    > If you made it "ByRef Value As Any" then you could use any VB type since
    > only the address of the value would be put on the stack for the call.
    > Addresses are all 32-bit integers so they all fit. Of course, for a

    String
    > that means you send the address of the BSTR version and most API calls do
    > not work correctly with them.
    >
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center