DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 4 123 ... LastLast
Results 1 to 15 of 49

Thread: GetProcAddress and usage in VB question ?

  1. #1
    Geoff (CADS) Guest

    GetProcAddress and usage in VB question ?

    Two parts to the question really.
    Part 1 - How do I create a DLL from Visual Basic that exports functions (as
    C++ does with __stdcall) ?
    I don't think it's possible from what I've read in MSDN, as VB only seems to
    create COM DLL's.

    Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    pointer to the function I want to
    call, but how do I use it ?

    The reason for using LoadLibrary is that I'm writing a system that uses DLLs
    as plug-ins that can be
    written by third parties (hence I can't Declare them).
    The calling convention and parameters will always be the same.

    ANY help greatly appreciated

    Geoff




  2. #2
    Peter Young Guest

    Re: GetProcAddress and usage in VB question ?

    Geoff,

    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?


    While you can't do this natively in VB, Desaware's SpyWorks package has a
    tool that will get you there. www.desaware.com

    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?


    A guy by the name of Michael Culley wrote a slick little routine to do this.
    The only place I've found it is in a module available at
    http://www.w-s-s.de/ Look for InstallOCX.bas.

    I've used both of these with success.

    HTH,

    Peter Young

    Geoff (CADS) <geoff@cads.co.uk> wrote in message
    news:393bbaf3$1@news.devx.com...
    > Two parts to the question really.
    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?
    > I don't think it's possible from what I've read in MSDN, as VB only seems

    to
    > create COM DLL's.
    >
    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?
    >
    > The reason for using LoadLibrary is that I'm writing a system that uses

    DLLs
    > as plug-ins that can be
    > written by third parties (hence I can't Declare them).
    > The calling convention and parameters will always be the same.
    >
    > ANY help greatly appreciated
    >
    > Geoff
    >
    >
    >




  3. #3
    Peter Young Guest

    Re: GetProcAddress and usage in VB question ?

    Geoff,

    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?


    While you can't do this natively in VB, Desaware's SpyWorks package has a
    tool that will get you there. www.desaware.com

    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?


    A guy by the name of Michael Culley wrote a slick little routine to do this.
    The only place I've found it is in a module available at
    http://www.w-s-s.de/ Look for InstallOCX.bas.

    I've used both of these with success.

    HTH,

    Peter Young

    Geoff (CADS) <geoff@cads.co.uk> wrote in message
    news:393bbaf3$1@news.devx.com...
    > Two parts to the question really.
    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?
    > I don't think it's possible from what I've read in MSDN, as VB only seems

    to
    > create COM DLL's.
    >
    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?
    >
    > The reason for using LoadLibrary is that I'm writing a system that uses

    DLLs
    > as plug-ins that can be
    > written by third parties (hence I can't Declare them).
    > The calling convention and parameters will always be the same.
    >
    > ANY help greatly appreciated
    >
    > Geoff
    >
    >
    >




  4. #4
    Jonathan Wood Guest

    Re: GetProcAddress and usage in VB question ?

    Geoff,

    > Two parts to the question really.
    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?
    > I don't think it's possible from what I've read in MSDN, as VB only seems

    to
    > create COM DLL's.


    You are correct.

    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?
    >
    > The reason for using LoadLibrary is that I'm writing a system that uses

    DLLs
    > as plug-ins that can be
    > written by third parties (hence I can't Declare them).
    > The calling convention and parameters will always be the same.


    VB provides no direct support for that. Although there are some APIs that
    can be used, they only handle a couple of combinations of arguments and
    return types.

    A more complete solution is the CallPtr library posted on our web site. It's
    free, documented and it will allow you to call a pointer to a function with
    any arguments and return types.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com



  5. #5
    Jonathan Wood Guest

    Re: GetProcAddress and usage in VB question ?

    Geoff,

    > Two parts to the question really.
    > Part 1 - How do I create a DLL from Visual Basic that exports functions

    (as
    > C++ does with __stdcall) ?
    > I don't think it's possible from what I've read in MSDN, as VB only seems

    to
    > create COM DLL's.


    You are correct.

    > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > pointer to the function I want to
    > call, but how do I use it ?
    >
    > The reason for using LoadLibrary is that I'm writing a system that uses

    DLLs
    > as plug-ins that can be
    > written by third parties (hence I can't Declare them).
    > The calling convention and parameters will always be the same.


    VB provides no direct support for that. Although there are some APIs that
    can be used, they only handle a couple of combinations of arguments and
    return types.

    A more complete solution is the CallPtr library posted on our web site. It's
    free, documented and it will allow you to call a pointer to a function with
    any arguments and return types.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com



  6. #6
    Geoff (CADS) Guest

    Re: GetProcAddress and usage in VB question ?

    Thank you both for the (extremely) quick response. I really didn't think
    I'd be able to
    do it without writing a C wrapper dll.



    Peter Young <pyoung@mr.net> wrote in message news:393bc754@news.devx.com...
    > Geoff,
    >
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?

    >
    > While you can't do this natively in VB, Desaware's SpyWorks package has a
    > tool that will get you there. www.desaware.com
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?

    >
    > A guy by the name of Michael Culley wrote a slick little routine to do

    this.
    > The only place I've found it is in a module available at
    > http://www.w-s-s.de/ Look for InstallOCX.bas.
    >
    > I've used both of these with success.
    >
    > HTH,
    >
    > Peter Young
    >
    > Geoff (CADS) <geoff@cads.co.uk> wrote in message
    > news:393bbaf3$1@news.devx.com...
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.
    > >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.
    > >
    > > ANY help greatly appreciated
    > >
    > > Geoff
    > >
    > >
    > >

    >
    >




  7. #7
    Geoff (CADS) Guest

    Re: GetProcAddress and usage in VB question ?

    Thank you both for the (extremely) quick response. I really didn't think
    I'd be able to
    do it without writing a C wrapper dll.



    Peter Young <pyoung@mr.net> wrote in message news:393bc754@news.devx.com...
    > Geoff,
    >
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?

    >
    > While you can't do this natively in VB, Desaware's SpyWorks package has a
    > tool that will get you there. www.desaware.com
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?

    >
    > A guy by the name of Michael Culley wrote a slick little routine to do

    this.
    > The only place I've found it is in a module available at
    > http://www.w-s-s.de/ Look for InstallOCX.bas.
    >
    > I've used both of these with success.
    >
    > HTH,
    >
    > Peter Young
    >
    > Geoff (CADS) <geoff@cads.co.uk> wrote in message
    > news:393bbaf3$1@news.devx.com...
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.
    > >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.
    > >
    > > ANY help greatly appreciated
    > >
    > > Geoff
    > >
    > >
    > >

    >
    >




  8. #8
    Michael \(michka\) Kaplan Guest

    Re: GetProcAddress and usage in VB question ?

    Actually, you are very wrong. Matt Curland wrote up a method for doing this
    NATIVELY earlier this year in VBPJ. I believe in the February 2000 issue?

    --
    MichKa
    "Cause it's a bittersweet symphony, thats life..." -- The Verve

    random junk of dubious value, at the multilingual,
    no scripts required, http://www.trigeminal.com/

    "Peter Young" <pyoung@mr.net> wrote in message
    news:393bc754@news.devx.com...
    > Geoff,
    >
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?

    >
    > While you can't do this natively in VB, Desaware's SpyWorks package has a
    > tool that will get you there. www.desaware.com
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?

    >
    > A guy by the name of Michael Culley wrote a slick little routine to do

    this.
    > The only place I've found it is in a module available at
    > http://www.w-s-s.de/ Look for InstallOCX.bas.
    >
    > I've used both of these with success.
    >
    > HTH,
    >
    > Peter Young
    >
    > Geoff (CADS) <geoff@cads.co.uk> wrote in message
    > news:393bbaf3$1@news.devx.com...
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.
    > >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.
    > >
    > > ANY help greatly appreciated
    > >
    > > Geoff
    > >
    > >
    > >

    >
    >




  9. #9
    Michael \(michka\) Kaplan Guest

    Re: GetProcAddress and usage in VB question ?

    Actually, you are very wrong. Matt Curland wrote up a method for doing this
    NATIVELY earlier this year in VBPJ. I believe in the February 2000 issue?

    --
    MichKa
    "Cause it's a bittersweet symphony, thats life..." -- The Verve

    random junk of dubious value, at the multilingual,
    no scripts required, http://www.trigeminal.com/

    "Peter Young" <pyoung@mr.net> wrote in message
    news:393bc754@news.devx.com...
    > Geoff,
    >
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?

    >
    > While you can't do this natively in VB, Desaware's SpyWorks package has a
    > tool that will get you there. www.desaware.com
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?

    >
    > A guy by the name of Michael Culley wrote a slick little routine to do

    this.
    > The only place I've found it is in a module available at
    > http://www.w-s-s.de/ Look for InstallOCX.bas.
    >
    > I've used both of these with success.
    >
    > HTH,
    >
    > Peter Young
    >
    > Geoff (CADS) <geoff@cads.co.uk> wrote in message
    > news:393bbaf3$1@news.devx.com...
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.
    > >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.
    > >
    > > ANY help greatly appreciated
    > >
    > > Geoff
    > >
    > >
    > >

    >
    >




  10. #10
    Michael \(michka\) Kaplan Guest

    Re: GetProcAddress and usage in VB question ?

    Jonathan,

    Matt Curland has written up a native solution for calling function pointers
    in VB.

    --
    MichKa
    "Cause it's a bittersweet symphony, thats life..." -- The Verve

    random junk of dubious value, at the multilingual,
    no scripts required, http://www.trigeminal.com/

    "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    news:393bc124@news.devx.com...
    > Geoff,
    >
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.

    >
    > You are correct.
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.

    >
    > VB provides no direct support for that. Although there are some APIs that
    > can be used, they only handle a couple of combinations of arguments and
    > return types.
    >
    > A more complete solution is the CallPtr library posted on our web site.

    It's
    > free, documented and it will allow you to call a pointer to a function

    with
    > any arguments and return types.
    >
    > --
    > Jonathan Wood
    > SoftCircuits Programming
    > http://www.softcircuits.com
    >
    >




  11. #11
    Michael \(michka\) Kaplan Guest

    Re: GetProcAddress and usage in VB question ?

    Jonathan,

    Matt Curland has written up a native solution for calling function pointers
    in VB.

    --
    MichKa
    "Cause it's a bittersweet symphony, thats life..." -- The Verve

    random junk of dubious value, at the multilingual,
    no scripts required, http://www.trigeminal.com/

    "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    news:393bc124@news.devx.com...
    > Geoff,
    >
    > > Two parts to the question really.
    > > Part 1 - How do I create a DLL from Visual Basic that exports functions

    > (as
    > > C++ does with __stdcall) ?
    > > I don't think it's possible from what I've read in MSDN, as VB only

    seems
    > to
    > > create COM DLL's.

    >
    > You are correct.
    >
    > > Part 2 - I can load a DLL into VB using LoadLibrary, and I can get the
    > > pointer to the function I want to
    > > call, but how do I use it ?
    > >
    > > The reason for using LoadLibrary is that I'm writing a system that uses

    > DLLs
    > > as plug-ins that can be
    > > written by third parties (hence I can't Declare them).
    > > The calling convention and parameters will always be the same.

    >
    > VB provides no direct support for that. Although there are some APIs that
    > can be used, they only handle a couple of combinations of arguments and
    > return types.
    >
    > A more complete solution is the CallPtr library posted on our web site.

    It's
    > free, documented and it will allow you to call a pointer to a function

    with
    > any arguments and return types.
    >
    > --
    > Jonathan Wood
    > SoftCircuits Programming
    > http://www.softcircuits.com
    >
    >




  12. #12
    Peter Young Guest

    Re: GetProcAddress and usage in VB question ?


    Michael,

    > Actually, you are very wrong. Matt Curland wrote up a method for doing

    this
    > NATIVELY earlier this year in VBPJ. I believe in the February 2000 issue?


    I am wrong about what? All I said was that Michael Culley wrote a routine to
    do this. His routine *is* VB-native, and is used precisely for what Geoff
    wanted to do.

    -Peter





  13. #13
    Peter Young Guest

    Re: GetProcAddress and usage in VB question ?


    Michael,

    > Actually, you are very wrong. Matt Curland wrote up a method for doing

    this
    > NATIVELY earlier this year in VBPJ. I believe in the February 2000 issue?


    I am wrong about what? All I said was that Michael Culley wrote a routine to
    do this. His routine *is* VB-native, and is used precisely for what Geoff
    wanted to do.

    -Peter





  14. #14
    Jonathan Wood Guest

    Re: GetProcAddress and usage in VB question ?

    Michael,

    > Matt Curland has written up a native solution for calling function

    pointers
    > in VB.


    One that works regardless of the argument and returns types expected by the
    function?

    How did he do that?

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com




  15. #15
    Jonathan Wood Guest

    Re: GetProcAddress and usage in VB question ?

    Michael,

    > Matt Curland has written up a native solution for calling function

    pointers
    > in VB.


    One that works regardless of the argument and returns types expected by the
    function?

    How did he do that?

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com




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