Says, Cannot find project or library at that line of code.. and opens up the Reference dialog pointing to a MISSING reference: 'MISSING: Debug Object for AddressOf Subclassing'
The hInst value is a handle passed by value, there is no question about this.
In fact, if you change it to byref then the hook procedure returns an error because you have an invalid handle
Just remove that from the reference, it isn't needed.
Hey, moeur!! I am not a n00b.. lol.. have n't u still understood? I was just pointing out how Visual Basic is reacting differently... When u have a missing reference ( i know that u forgot to remove it while attaching your project ), why should VB complain on the line: strData = Space(dataStruct.cbData, 0)
Oops, i dint put the above line in my previous post.. i was incomplete.. sorry!
Space function accepts only one parameter which is the length of spaces you need. And so VB is supposed to error: Wrong number of arguments. But i was just playing around how VB reacts when u have a missing reference.. hmm, think i should not play around, just misleads to many stuff..
Also, moeur, when u run your EXE press Ctrl+F5 with codes implementing Subclassing.. which makes sure u dont have any compiler error!
And i dont understand your old quote:
Originally Posted by moeur
The hInst value is a handle passed by value, there is no question about this.
In fact, if you change it to byref then the hook procedure returns an error because you have an invalid handle
Nopez, cant you see that any LPVOID is nothing but a pointer which is obviously pointer... You have just given your DLL code having the DllMain as:
VB Code:
Public Function DLLMain([hl]hInst As Long[/hl], ByVal fdwReason As Long, _
lpvReserved As Long) As Long
which is ByRef.. What are you trying to tell?? You seem to contradict your own code
Anyway, i will be back with the working code of your Notepad Hook.
This DLL was first featured in a VBPJ article by Matt Curland about subclassing with VB5. Its main purpose is to allow breaking into and stepping through code that subclasses windows, something not directly supported by VB.
To enable it you would change the compiler directive int cSubClass module to
VB Code:
#Const DEBUGWINDOWPROC = -1
However, set it back to zero before compiling.
For now though, you can even disable the subclassing until we fix the dll problem. Just comment out this code in the form module cmdHook_Click event
Did you move yor mouse over the top of notepad to generate a message? That's when it crashes for me.
PS: It's obvious you're not a NOOB, but I have to ask.
LOL, You got to be kidding me... I minimized, maximized, Type some message, Selected them through mouse, and did so many stuff but Notepad was stubborn that it wont crash, and the VB DLL was stubborn that it will not receive any message for the actions i did
I think I've gone full circle. A while back I was trying to find out how to make a callback from one thread in C++ dll to another thread in a VB exe. Well I never solved the problem and it has something to do with initializing the com objects VB need that are stored on a per thread basis.