我记得 全局钩子 要专门编个dll!可VB只支持 ActiveX Dll!

解决方案 »

  1.   

    vb做全局钩子很困难,你用vc做,在vb里调用吧。
      

  2.   

        hnw = WindowFromPoint(p.x, p.y)
        mystring = Space(256)  ***加上这句!!!
        GetClassName hnw, mystring, Len(mystring)
      

  3.   

    将 GetClassName 改为   GetWindowtext
      

  4.   

    有些很牛的人说VB可以做dll,可是我不会。
    我提供给你的方法就是:用VC作dll(主要就是把钩子函数放进去),然后再VB中SetWindowsHookEx的时候把那个钩子函数的地址传进去,最后一个参数(好像是dwThreadID)传入0
      

  5.   

       VB要做静态DLL基本不可能,即使是一般的钓子写起来也经常有问题,连大师都头痛:
    一位大师的话:
    You don’t need to hear the details of how I wasted time trying to capture keyboard events in a DLL hook procedure or with a message control. Suffice it to say that I pulled out every trick in this book, and none of them worked. I could display the dialog boxes on the screen. I could read text and settings from them. The mouse worked fine. But I couldn’t get the Tab and Enter keys to work.If you want to try this yourself, you’ll probably suffer some of the same frustrations I encountered, and possibly some new ones. Or maybe you’ll find the solution. But before you start down that road, consider the alternatives.
      

  6.   

    谢谢诸位!
    wjying(葡萄) :
    C 怎么写啊能说个例子吗!
      

  7.   

    : g8341(幄天) 我算是彻底服了你了!
                    如果你按我说的试试,你会发现你可以坐到你想要的!之所以会出错,是因为你的程序写的有问题!
                    当然,他们说的也没错,VB做全局钩子很困难,但你要的并用不到全局钩子,就用你上面的代码就可以实现!
      没办法,其实“水平”就显示在这!
      

  8.   

    http://www.csdn.net/expert/Topic/440/440349.shtm
    或者
    http://www.vckbase.com/vckbase/vckbase11/vc/nonctrls/system_30/1130008.htm
      

  9.   

    微软太贱了!!!!!!!!!!!!
    为什么VB不能做全局DLL
    我快受不了VB了!!!!!!!!!!