A little discuss about CBT hook


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: A little discuss about CBT hook

  1. #1
    Munim.VIP Guest

    A little discuss about CBT hook

    hello experts,
    i'm a very beginner to this programming world, and i faced a problem, with
    the cbt hook. as i know that, cbt hook don't need to call or hook from a dll
    file. my aim is to get notification when a window is created and to be
    destoryed in any program (system wide)... i've worked in it, but it crashes
    when a window is created... still it works fine with the current process...
    but i need system-wide without dll... plz help me with this... i'll be very
    greatful to you forever...

    Munim.VIP

    PS: CBT or SHELL hook is appropriated...



  2. #2
    Juergen Thuemmler Guest

    Re: A little discuss about CBT hook

    > PS: CBT or SHELL hook is appropriated...

    www.allapi.net -> VB-Tools -> DSCBTSHL

    Juergen.



  3. #3
    Munim.VIP Guest

    Re: A little discuss about CBT hook

    i don't want any extra dependencies in my project... i need the pure api
    solution... (setwindowshookex)...

    > > PS: CBT or SHELL hook is appropriated...

    >
    > www.allapi.net -> VB-Tools -> DSCBTSHL
    >
    > Juergen.
    >
    >




  4. #4
    Juergen Thuemmler Guest

    Re: A little discuss about CBT hook

    > i don't want any extra dependencies in my project... i need the pure api
    > solution... (setwindowshookex)...


    Then you cannot solve your problem. You really need a Standard DLL.

    Juergen.



  5. #5
    Jonathan Wood Guest

    Re: A little discuss about CBT hook

    Munim.VIP,

    > i don't want any extra dependencies in my project... i need the pure api
    > solution... (setwindowshookex)...


    Cannot be done without solving some very difficult issues.

    FWIW, this is not a good task for someone who is "very beginner to this
    programming world." Even if you find a ready-made solution that works well,
    there are some difficult problems you can run into whenever you're dealing
    with any system-wide hook

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



  6. #6
    Munim.VIP Guest

    Re: A little discuss about CBT hook

    thanx Jonathan Wood,
    as i told before, with SetWindowsHookEx, it works fine with the current
    thread, The current thread ID is has been specified in the last parameter of
    the SetWindowsHookEx function call. when, i specify this parameter as 0 (as
    it says to get all thread in desktop - msdn), the fact starts here, after
    that, with current thread, it works perfectly, but when i start another
    process/application my system halts when i compile in delphi or vc++, and in
    vb, just crashes, looking same problem. as i know, it is possible to do
    application-based system-wide cbt hook (not libraray-based). anyway, i'll be
    very glad if anybody plz help me, i'm hanging with this for the last 5-6
    days.

    Jonathan Wood: U said that this can be done by critical way. plz tell me the
    way to do it. looking forward to hear form u.

    Munim.VIP

    ..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-.

    "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    news:3d171a48@10.1.10.29...
    > Munim.VIP,
    >
    > > i don't want any extra dependencies in my project... i need the pure api
    > > solution... (setwindowshookex)...

    >
    > Cannot be done without solving some very difficult issues.
    >
    > FWIW, this is not a good task for someone who is "very beginner to this
    > programming world." Even if you find a ready-made solution that works

    well,
    > there are some difficult problems you can run into whenever you're dealing
    > with any system-wide hook
    >
    > --
    > Jonathan Wood
    > SoftCircuits Programming
    > http://www.softcircuits.com
    >
    >








  7. #7
    Jonathan Wood Guest

    Re: A little discuss about CBT hook

    Munim.VIP,

    > Jonathan Wood: U said that this can be done by critical way. plz tell me

    the
    > way to do it. looking forward to hear form u.


    I don't know how else to say it: This is very difficult. I'm not 100% sure
    that it is possible to do in VB alone and I've been a VB columnist for many
    years.

    If you don't trust me that this is not a beginner task then here's how you
    do it: You must put your hook procedure in a DLL. Note that the DLL will be
    mapped into any process that gets hooked. This means your DLL handler will
    be running in another process when it gets called. This means you will not
    have access to any variables in your applications process. Somehow, you have
    to coordinate all instances of the handler being called and funnel them back
    to your application. I'm not sure of all the details, but I suspect this
    will be a horrible drain on system resources since every time your DLL gets
    mapped into another process, I suspect the VB runtime would also need to be
    mapped to that process.

    Can I recommend SpyWorks? This will still be an advanced task but SpyWorks
    will take care of the most difficult aspects of this.

    > Munim.VIP
    >
    >

    ..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-.
    >
    > "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    > news:3d171a48@10.1.10.29...
    > > Munim.VIP,
    > >
    > > > i don't want any extra dependencies in my project... i need the pure

    api
    > > > solution... (setwindowshookex)...

    > >
    > > Cannot be done without solving some very difficult issues.
    > >
    > > FWIW, this is not a good task for someone who is "very beginner to this
    > > programming world." Even if you find a ready-made solution that works

    > well,
    > > there are some difficult problems you can run into whenever you're

    dealing
    > > with any system-wide hook
    > >
    > > --
    > > Jonathan Wood
    > > SoftCircuits Programming
    > > http://www.softcircuits.com
    > >
    > >

    >
    >
    >
    >
    >
    >


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



  8. #8
    Munim.VIP Guest

    Re: A little discuss about CBT hook

    Jonathan Wood,
    i never said that i'm doing it on vb, i've coded in delphi and vc++
    also... anyway, i've created a shared memory library for this hooking, not
    in vb, cuz vb sucks, at these stuffs... calling hooks from a library or
    creating libraries for hooking is easy like water. but my fact is to keep it
    in application-based... my experience tells me that this can be done the way
    i'm thinking... thank u for the procedures, Jonathan Wood... actually, the
    way u told me is not that much difficult to do it... i hate dependencies,
    for that i don't code in vb... for your kindness... plz, inform me if
    anybody can able to do it in application-based... i'm very much sorry
    Jonathan Wood 4 my inconvenience...

    Munim.VIP

    "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    news:3d188fae@10.1.10.29...
    > Munim.VIP,
    >
    > > Jonathan Wood: U said that this can be done by critical way. plz tell me

    > the
    > > way to do it. looking forward to hear form u.

    >
    > I don't know how else to say it: This is very difficult. I'm not 100% sure
    > that it is possible to do in VB alone and I've been a VB columnist for

    many
    > years.
    >
    > If you don't trust me that this is not a beginner task then here's how you
    > do it: You must put your hook procedure in a DLL. Note that the DLL will

    be
    > mapped into any process that gets hooked. This means your DLL handler will
    > be running in another process when it gets called. This means you will not
    > have access to any variables in your applications process. Somehow, you

    have
    > to coordinate all instances of the handler being called and funnel them

    back
    > to your application. I'm not sure of all the details, but I suspect this
    > will be a horrible drain on system resources since every time your DLL

    gets
    > mapped into another process, I suspect the VB runtime would also need to

    be
    > mapped to that process.
    >
    > Can I recommend SpyWorks? This will still be an advanced task but SpyWorks
    > will take care of the most difficult aspects of this.
    >
    > > Munim.VIP
    > >
    > >

    >

    ..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-..-'-.
    > >
    > > "Jonathan Wood" <jwood@softcircuits.com> wrote in message
    > > news:3d171a48@10.1.10.29...
    > > > Munim.VIP,
    > > >
    > > > > i don't want any extra dependencies in my project... i need the pure

    > api
    > > > > solution... (setwindowshookex)...
    > > >
    > > > Cannot be done without solving some very difficult issues.
    > > >
    > > > FWIW, this is not a good task for someone who is "very beginner to

    this
    > > > programming world." Even if you find a ready-made solution that works

    > > well,
    > > > there are some difficult problems you can run into whenever you're

    > dealing
    > > > with any system-wide hook
    > > >
    > > > --
    > > > Jonathan Wood
    > > > SoftCircuits Programming
    > > > http://www.softcircuits.com
    > > >
    > > >

    > >
    > >
    > >
    > >
    > >
    > >

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




  9. #9
    Jonathan Wood Guest

    Re: A little discuss about CBT hook

    Munim.VIP,

    > i never said that i'm doing it on vb, i've coded in delphi and vc++
    > also...


    Okay then, I'd recommend using C for this. (I assumed you were using VB
    because you posted the question in a VB newsgroup.)

    > anyway, i've created a shared memory library for this hooking, not
    > in vb, cuz vb sucks, at these stuffs... calling hooks from a library or
    > creating libraries for hooking is easy like water.


    Are you sure you *fully* understood the part about being mapped into another
    process?

    > but my fact is to keep it
    > in application-based... my experience tells me that this can be done the

    way
    > i'm thinking...


    The callback for a *system-wide* hook MUST be in a DLL. I explained a little
    bit about why this is necessary. No one on this planet can solve the issue
    without a DLL. Sorry, that's just the way it is.

    --
    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