Hi Alec,
Okay I took a look at your code. This is probably wrong:
lngOriginal_Window_Procedure:=GetWindowLong(Application.Handle,1);
In my example the way you get the handle of the original window procedure should be by usurping it. However if your original window procedure doesn't need to subclassed (overridden) then that is okay.
You may want to re-read my example and make sure that any time I make an API call you do to!
If you can't recognize a command, then it's probably a windows API command. Reference your Win32.hlp file:
"C:\Program Files\Common Files\Borland Shared\MSHelp\WIN32.HLP"
to see whether or not a particular command is an API call.
Once you think you're properly intercepting the Window's Event Handling procedure, you'll want to send a test message to it and process the test message. So from another program send something like
(note lngWindow_Handle is the handle of the Window [not the windows event handler] or your application if it's entirely procedural)
SendMessage lngWindow_Handle, WMUSER + 501, 0, 0
Then from your window handling procedure you'll want to check for a WMUSER+501 message and when you receive it display a messagebox so you know you received it properly. As for the + 501, check the help file and make sure my recommendation is beyond the range of the Common Controls library. This can be found by using the aforementioned help file and looking up WM_USER.
If you don't know how to find the handle of another program, you'll want to use FindWindow a windows api call. If you don't know how to find the classname of a window use Spy++.
Good Luck,
Christian Blackburn