DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 59

Thread: callback function

  1. #16
    Mike Culley Guest

    Re: callback function


    Jonathan,

    >The only question is how to obtain the address of the callback function.



    I don't emulate the AddressOf function. Instead I do without it.

    I just want to post something that works.

    Michael Culley

    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >Most of us are more than capable of putting something together like this.
    >The only question is how to obtain the address of the callback function.

    Why
    >not just state how?
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >
    >Mike Culley <m_culley@one.net.au> wrote in message
    >news:392c835a$1@news.devx.com...
    >>
    >> Jason,
    >>
    >> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    VB
    >> code. I'll do an example of an API timer, but I can't do it until tonight
    >> (I am at work).
    >>
    >> Michael Culley
    >>
    >> "Jason Bock" <jrbock@execpc.com> wrote:
    >> >> Karl,
    >> >>
    >> >> This is a myth - you can do callbacks in VB4. I will get a sample

    >going,
    >> >> but it will take a day or so before I get the time.
    >> >
    >> >With no other DLLs? Or will you write something in VC++ or PowerBASIC

    >that
    >> >will help you out here? Or are you talking about COM interface

    >callbacks?
    >> >
    >> >I'd be interested to see if you can get something like AddressOf working

    >> in
    >> >VB4 using nothing but VB4.
    >> >
    >> >Regards,
    >> >
    >> >Jason
    >> >
    >> >

    >>

    >
    >



  2. #17
    Mike Culley Guest

    Re: callback function


    Jonathan,

    >The only question is how to obtain the address of the callback function.



    I don't emulate the AddressOf function. Instead I do without it.

    I just want to post something that works.

    Michael Culley

    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >Most of us are more than capable of putting something together like this.
    >The only question is how to obtain the address of the callback function.

    Why
    >not just state how?
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >
    >Mike Culley <m_culley@one.net.au> wrote in message
    >news:392c835a$1@news.devx.com...
    >>
    >> Jason,
    >>
    >> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    VB
    >> code. I'll do an example of an API timer, but I can't do it until tonight
    >> (I am at work).
    >>
    >> Michael Culley
    >>
    >> "Jason Bock" <jrbock@execpc.com> wrote:
    >> >> Karl,
    >> >>
    >> >> This is a myth - you can do callbacks in VB4. I will get a sample

    >going,
    >> >> but it will take a day or so before I get the time.
    >> >
    >> >With no other DLLs? Or will you write something in VC++ or PowerBASIC

    >that
    >> >will help you out here? Or are you talking about COM interface

    >callbacks?
    >> >
    >> >I'd be interested to see if you can get something like AddressOf working

    >> in
    >> >VB4 using nothing but VB4.
    >> >
    >> >Regards,
    >> >
    >> >Jason
    >> >
    >> >

    >>

    >
    >



  3. #18
    Michael Culley Guest

    Re: callback function


    It is available at

    www.VBDotCom.com

    Click on free code. The timer is the last item in the list.

    It is not necessary to use VB4 to test it, it works also in vb5 and 6.

    Michael Culley


    "Mike Culley" <m_culley@one.net.au> wrote:
    >
    >Jonathan,
    >
    >>The only question is how to obtain the address of the callback function.

    >
    >
    >I don't emulate the AddressOf function. Instead I do without it.
    >
    >I just want to post something that works.
    >
    >Michael Culley
    >
    >"Jonathan Wood" <jwood@softcircuits.com> wrote:
    >>Most of us are more than capable of putting something together like this.
    >>The only question is how to obtain the address of the callback function.

    >Why
    >>not just state how?
    >>
    >>--
    >>Jonathan Wood
    >>SoftCircuits Programming
    >>http://www.softcircuits.com
    >>
    >>Mike Culley <m_culley@one.net.au> wrote in message
    >>news:392c835a$1@news.devx.com...
    >>>
    >>> Jason,
    >>>
    >>> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    >VB
    >>> code. I'll do an example of an API timer, but I can't do it until tonight
    >>> (I am at work).
    >>>
    >>> Michael Culley
    >>>
    >>> "Jason Bock" <jrbock@execpc.com> wrote:
    >>> >> Karl,
    >>> >>
    >>> >> This is a myth - you can do callbacks in VB4. I will get a sample

    >>going,
    >>> >> but it will take a day or so before I get the time.
    >>> >
    >>> >With no other DLLs? Or will you write something in VC++ or PowerBASIC

    >>that
    >>> >will help you out here? Or are you talking about COM interface

    >>callbacks?
    >>> >
    >>> >I'd be interested to see if you can get something like AddressOf working
    >>> in
    >>> >VB4 using nothing but VB4.
    >>> >
    >>> >Regards,
    >>> >
    >>> >Jason
    >>> >
    >>> >
    >>>

    >>
    >>

    >



  4. #19
    Michael Culley Guest

    Re: callback function


    It is available at

    www.VBDotCom.com

    Click on free code. The timer is the last item in the list.

    It is not necessary to use VB4 to test it, it works also in vb5 and 6.

    Michael Culley


    "Mike Culley" <m_culley@one.net.au> wrote:
    >
    >Jonathan,
    >
    >>The only question is how to obtain the address of the callback function.

    >
    >
    >I don't emulate the AddressOf function. Instead I do without it.
    >
    >I just want to post something that works.
    >
    >Michael Culley
    >
    >"Jonathan Wood" <jwood@softcircuits.com> wrote:
    >>Most of us are more than capable of putting something together like this.
    >>The only question is how to obtain the address of the callback function.

    >Why
    >>not just state how?
    >>
    >>--
    >>Jonathan Wood
    >>SoftCircuits Programming
    >>http://www.softcircuits.com
    >>
    >>Mike Culley <m_culley@one.net.au> wrote in message
    >>news:392c835a$1@news.devx.com...
    >>>
    >>> Jason,
    >>>
    >>> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    >VB
    >>> code. I'll do an example of an API timer, but I can't do it until tonight
    >>> (I am at work).
    >>>
    >>> Michael Culley
    >>>
    >>> "Jason Bock" <jrbock@execpc.com> wrote:
    >>> >> Karl,
    >>> >>
    >>> >> This is a myth - you can do callbacks in VB4. I will get a sample

    >>going,
    >>> >> but it will take a day or so before I get the time.
    >>> >
    >>> >With no other DLLs? Or will you write something in VC++ or PowerBASIC

    >>that
    >>> >will help you out here? Or are you talking about COM interface

    >>callbacks?
    >>> >
    >>> >I'd be interested to see if you can get something like AddressOf working
    >>> in
    >>> >VB4 using nothing but VB4.
    >>> >
    >>> >Regards,
    >>> >
    >>> >Jason
    >>> >
    >>> >
    >>>

    >>
    >>

    >



  5. #20
    Jason Bock Guest

    Re: callback function

    It looks interesting, but your Class_Initialize method is confusing at best,
    and to me that is where the core of your code is. It ~appears~ that you are
    walking the vtable of your clsTimer object and finding out where your
    TimerProc method lies, but it's hard to tell. If you could explain just
    what you are doing and why you are doing all of the CopyMemory calls and why
    you chose all of the values for mbytData, that would help out a lot. Also,
    since TimerProc is Public, any client can call this method, which is
    problematic at best. I realize that if you are walking the vtable, you
    really didn't have a choice in this case, but this leads to programming by
    convention (i.e. the client has to know not to call this method).

    Also, have you tested this out with any other APIs that require a callback?

    Regards,

    Jason

    "Michael Culley" <m_culley@one.net.au> wrote in message
    news:392d30a5$1@news.devx.com...
    >
    > It is available at
    >
    > www.VBDotCom.com
    >
    > Click on free code. The timer is the last item in the list.
    >
    > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    >
    > Michael Culley





  6. #21
    Jason Bock Guest

    Re: callback function

    It looks interesting, but your Class_Initialize method is confusing at best,
    and to me that is where the core of your code is. It ~appears~ that you are
    walking the vtable of your clsTimer object and finding out where your
    TimerProc method lies, but it's hard to tell. If you could explain just
    what you are doing and why you are doing all of the CopyMemory calls and why
    you chose all of the values for mbytData, that would help out a lot. Also,
    since TimerProc is Public, any client can call this method, which is
    problematic at best. I realize that if you are walking the vtable, you
    really didn't have a choice in this case, but this leads to programming by
    convention (i.e. the client has to know not to call this method).

    Also, have you tested this out with any other APIs that require a callback?

    Regards,

    Jason

    "Michael Culley" <m_culley@one.net.au> wrote in message
    news:392d30a5$1@news.devx.com...
    >
    > It is available at
    >
    > www.VBDotCom.com
    >
    > Click on free code. The timer is the last item in the list.
    >
    > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    >
    > Michael Culley





  7. #22
    Jonathan Wood Guest

    Re: callback function

    Michael,

    > It is available at
    >
    > www.VBDotCom.com


    Do I need to wade through all 24 files or are you going to just tell us how
    you can do a callback without AddressOf?

    BTW, I looked through modTimer.bas and found the following line:

    lngId = SetTimer(0, 0, lngInterval, AddressOf TimerProc)

    I can only assume you have some reason for not wanting to offer anything to
    the public discussion here.

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




  8. #23
    Jonathan Wood Guest

    Re: callback function

    Michael,

    > It is available at
    >
    > www.VBDotCom.com


    Do I need to wade through all 24 files or are you going to just tell us how
    you can do a callback without AddressOf?

    BTW, I looked through modTimer.bas and found the following line:

    lngId = SetTimer(0, 0, lngInterval, AddressOf TimerProc)

    I can only assume you have some reason for not wanting to offer anything to
    the public discussion here.

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




  9. #24
    Jonathan Wood Guest

    Re: callback function

    Please forgive my last post as it appears I initially downloaded the wrong
    file.

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

    Michael Culley <m_culley@one.net.au> wrote in message
    news:392d30a5$1@news.devx.com...
    >
    > It is available at
    >
    > www.VBDotCom.com
    >
    > Click on free code. The timer is the last item in the list.
    >
    > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    >
    > Michael Culley
    >
    >
    > "Mike Culley" <m_culley@one.net.au> wrote:
    > >
    > >Jonathan,
    > >
    > >>The only question is how to obtain the address of the callback function.

    > >
    > >
    > >I don't emulate the AddressOf function. Instead I do without it.
    > >
    > >I just want to post something that works.
    > >
    > >Michael Culley
    > >
    > >"Jonathan Wood" <jwood@softcircuits.com> wrote:
    > >>Most of us are more than capable of putting something together like

    this.
    > >>The only question is how to obtain the address of the callback function.

    > >Why
    > >>not just state how?
    > >>
    > >>--
    > >>Jonathan Wood
    > >>SoftCircuits Programming
    > >>http://www.softcircuits.com
    > >>
    > >>Mike Culley <m_culley@one.net.au> wrote in message
    > >>news:392c835a$1@news.devx.com...
    > >>>
    > >>> Jason,
    > >>>
    > >>> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    > >VB
    > >>> code. I'll do an example of an API timer, but I can't do it until

    tonight
    > >>> (I am at work).
    > >>>
    > >>> Michael Culley
    > >>>
    > >>> "Jason Bock" <jrbock@execpc.com> wrote:
    > >>> >> Karl,
    > >>> >>
    > >>> >> This is a myth - you can do callbacks in VB4. I will get a sample
    > >>going,
    > >>> >> but it will take a day or so before I get the time.
    > >>> >
    > >>> >With no other DLLs? Or will you write something in VC++ or

    PowerBASIC
    > >>that
    > >>> >will help you out here? Or are you talking about COM interface
    > >>callbacks?
    > >>> >
    > >>> >I'd be interested to see if you can get something like AddressOf

    working
    > >>> in
    > >>> >VB4 using nothing but VB4.
    > >>> >
    > >>> >Regards,
    > >>> >
    > >>> >Jason
    > >>> >
    > >>> >
    > >>>
    > >>
    > >>

    > >

    >




  10. #25
    Jonathan Wood Guest

    Re: callback function

    Please forgive my last post as it appears I initially downloaded the wrong
    file.

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

    Michael Culley <m_culley@one.net.au> wrote in message
    news:392d30a5$1@news.devx.com...
    >
    > It is available at
    >
    > www.VBDotCom.com
    >
    > Click on free code. The timer is the last item in the list.
    >
    > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    >
    > Michael Culley
    >
    >
    > "Mike Culley" <m_culley@one.net.au> wrote:
    > >
    > >Jonathan,
    > >
    > >>The only question is how to obtain the address of the callback function.

    > >
    > >
    > >I don't emulate the AddressOf function. Instead I do without it.
    > >
    > >I just want to post something that works.
    > >
    > >Michael Culley
    > >
    > >"Jonathan Wood" <jwood@softcircuits.com> wrote:
    > >>Most of us are more than capable of putting something together like

    this.
    > >>The only question is how to obtain the address of the callback function.

    > >Why
    > >>not just state how?
    > >>
    > >>--
    > >>Jonathan Wood
    > >>SoftCircuits Programming
    > >>http://www.softcircuits.com
    > >>
    > >>Mike Culley <m_culley@one.net.au> wrote in message
    > >>news:392c835a$1@news.devx.com...
    > >>>
    > >>> Jason,
    > >>>
    > >>> It does not use any Dlls or C code or AddIns/Compiler Modifiers - just

    > >VB
    > >>> code. I'll do an example of an API timer, but I can't do it until

    tonight
    > >>> (I am at work).
    > >>>
    > >>> Michael Culley
    > >>>
    > >>> "Jason Bock" <jrbock@execpc.com> wrote:
    > >>> >> Karl,
    > >>> >>
    > >>> >> This is a myth - you can do callbacks in VB4. I will get a sample
    > >>going,
    > >>> >> but it will take a day or so before I get the time.
    > >>> >
    > >>> >With no other DLLs? Or will you write something in VC++ or

    PowerBASIC
    > >>that
    > >>> >will help you out here? Or are you talking about COM interface
    > >>callbacks?
    > >>> >
    > >>> >I'd be interested to see if you can get something like AddressOf

    working
    > >>> in
    > >>> >VB4 using nothing but VB4.
    > >>> >
    > >>> >Regards,
    > >>> >
    > >>> >Jason
    > >>> >
    > >>> >
    > >>>
    > >>
    > >>

    > >

    >




  11. #26
    Paul Clement Guest

    Re: callback function

    On 25 May 2000 06:54:45 -0700, "Michael Culley" <m_culley@one.net.au> wrote:


    It is available at

    www.VBDotCom.com

    Click on free code. The timer is the last item in the list.

    It is not necessary to use VB4 to test it, it works also in vb5 and 6.

    So, is this how "invalid page faults" are generated? ;-)


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  12. #27
    Paul Clement Guest

    Re: callback function

    On 25 May 2000 06:54:45 -0700, "Michael Culley" <m_culley@one.net.au> wrote:


    It is available at

    www.VBDotCom.com

    Click on free code. The timer is the last item in the list.

    It is not necessary to use VB4 to test it, it works also in vb5 and 6.

    So, is this how "invalid page faults" are generated? ;-)


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  13. #28
    Jonathan Wood Guest

    Re: callback function

    Yep, he didn't want to answer the question here. Then he posts some code
    that has hardly a comment.

    I for one would not assume this code will always work reliably given what I
    know. Maybe if I get some time, I'll try to go through it some time.

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

    Jason Bock <jrbock@execpc.com> wrote in message
    news:392d4455$1@news.devx.com...
    > It looks interesting, but your Class_Initialize method is confusing at

    best,
    > and to me that is where the core of your code is. It ~appears~ that you

    are
    > walking the vtable of your clsTimer object and finding out where your
    > TimerProc method lies, but it's hard to tell. If you could explain just
    > what you are doing and why you are doing all of the CopyMemory calls and

    why
    > you chose all of the values for mbytData, that would help out a lot.

    Also,
    > since TimerProc is Public, any client can call this method, which is
    > problematic at best. I realize that if you are walking the vtable, you
    > really didn't have a choice in this case, but this leads to programming by
    > convention (i.e. the client has to know not to call this method).
    >
    > Also, have you tested this out with any other APIs that require a

    callback?
    >
    > Regards,
    >
    > Jason
    >
    > "Michael Culley" <m_culley@one.net.au> wrote in message
    > news:392d30a5$1@news.devx.com...
    > >
    > > It is available at
    > >
    > > www.VBDotCom.com
    > >
    > > Click on free code. The timer is the last item in the list.
    > >
    > > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    > >
    > > Michael Culley

    >
    >
    >




  14. #29
    Jonathan Wood Guest

    Re: callback function

    Yep, he didn't want to answer the question here. Then he posts some code
    that has hardly a comment.

    I for one would not assume this code will always work reliably given what I
    know. Maybe if I get some time, I'll try to go through it some time.

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

    Jason Bock <jrbock@execpc.com> wrote in message
    news:392d4455$1@news.devx.com...
    > It looks interesting, but your Class_Initialize method is confusing at

    best,
    > and to me that is where the core of your code is. It ~appears~ that you

    are
    > walking the vtable of your clsTimer object and finding out where your
    > TimerProc method lies, but it's hard to tell. If you could explain just
    > what you are doing and why you are doing all of the CopyMemory calls and

    why
    > you chose all of the values for mbytData, that would help out a lot.

    Also,
    > since TimerProc is Public, any client can call this method, which is
    > problematic at best. I realize that if you are walking the vtable, you
    > really didn't have a choice in this case, but this leads to programming by
    > convention (i.e. the client has to know not to call this method).
    >
    > Also, have you tested this out with any other APIs that require a

    callback?
    >
    > Regards,
    >
    > Jason
    >
    > "Michael Culley" <m_culley@one.net.au> wrote in message
    > news:392d30a5$1@news.devx.com...
    > >
    > > It is available at
    > >
    > > www.VBDotCom.com
    > >
    > > Click on free code. The timer is the last item in the list.
    > >
    > > It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    > >
    > > Michael Culley

    >
    >
    >




  15. #30
    Mike Culley Guest

    Re: callback function


    Jason,

    Please see my reply to Jonathan for comments on the code.

    >Also, since TimerProc is Public, any client can call this method, which

    is
    >problematic at best.


    This is true, but I have not found a way around this. If you are wrapping
    this in a dll you could solve this by wrapping the class.

    I have tried this with Hooks and Subclassing also with no problems, but the
    Class_Initialise routine had to be changed because the timerProc is a sub
    and the others are functions.

    Michael Culley

    "Jason Bock" <jrbock@execpc.com> wrote:
    >It looks interesting, but your Class_Initialize method is confusing at best,
    >and to me that is where the core of your code is. It ~appears~ that you

    are
    >walking the vtable of your clsTimer object and finding out where your
    >TimerProc method lies, but it's hard to tell. If you could explain just
    >what you are doing and why you are doing all of the CopyMemory calls and

    why
    >you chose all of the values for mbytData, that would help out a lot. Also,
    >since TimerProc is Public, any client can call this method, which is
    >problematic at best. I realize that if you are walking the vtable, you
    >really didn't have a choice in this case, but this leads to programming

    by
    >convention (i.e. the client has to know not to call this method).
    >
    >Also, have you tested this out with any other APIs that require a callback?
    >
    >Regards,
    >
    >Jason
    >
    >"Michael Culley" <m_culley@one.net.au> wrote in message
    >news:392d30a5$1@news.devx.com...
    >>
    >> It is available at
    >>
    >> www.VBDotCom.com
    >>
    >> Click on free code. The timer is the last item in the list.
    >>
    >> It is not necessary to use VB4 to test it, it works also in vb5 and 6.
    >>
    >> Michael Culley

    >
    >
    >



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