Does anyone have a rough idea how to hook into a COM application?

Im doing some funky stuff with AutoCad and Voice recognition which is working quite well, however, there is some commands that are not accepted by autocad, since other's are running.

Ie. If i start a line via the "Line" command, and then say "End Point" to specify snaps to the endpoint of an object. The "End Point" command issued to Autocad via. OLE fails. THis is because the "Line.arx" is currently running, and to keep things syncronized it will not allow ANY other command via OLE.

Its a good thing really, but in my case its preventing me from being able to give sub commands to functions. Only top-level commands via. voice recognition.

So as a work around, i thought, i have the application Interface pointer, why not hook into it, and make the application think i typed these command into the console by sending WM_CHAR (or similar) messages to it. The console editor DOES allow asynchronouse commands, such as this.

However, the application Interface does not have a "HWND" property to utilize and get the window's handle.. which leads me to me posting this question..

If you have advice or an alternate suggestion please help ;)

As always, Thanks again.
Posted on 2003-07-06 00:47:50 by NaN
Well with some sluthing around with a windows spy tool, i found a backdoor to issue commands to Autocad. It stemmed from the fact that the ActiveDrawing interface (not Application) has a HWND property. Used by itself it doesnt do anything with WM_CHAR commands, but if i GetParent on it, i get a handle that will use and properly direct the WM_CHAR commands to the internals of the program :alright:

Its pretty cool now, I can put on my headset, and start drafting without touching a key! It also helps since most commands in autocaed are unique in their names and sound ("Circle" "Line" "Polyline" etc.)

Anywho, this works on win98se, and dont think it would be a problem for NT kernal os's since i legitimately got the child handle from OLE first.

However, If you still have any comments, im open to them ;)

Posted on 2003-07-06 03:14:43 by NaN
Absolutely great, NaN! :alright:
Posted on 2003-07-06 06:41:16 by japheth
I like the way you think :)
Posted on 2003-07-06 10:16:08 by Homer
Too cool. Would love to see that in operation.
Posted on 2003-07-06 10:29:42 by mrgone
Scotty says "How quaint, a keyboard", then starts typing on it as if he's done it all his life.

Good work Nan :alright:

When do we get the OS version and get rid of keyboards? ;)

Regards, P1 :cool:
Posted on 2003-07-06 15:02:47 by Pone
I also suspect your sitting in a vibrating chair and a fridge is at arms length. :grin: jk
Posted on 2003-07-06 15:25:41 by RobotBob
Wow, you should consider hooking it up to your lawnmower! May I
suggest that it may be useful to conduct a survey of and search for
other COM objects which support a similar mechanism.
Posted on 2003-07-06 17:58:57 by Poimander
Thanks for the support everyone! (Im surprised to be honest ~ didnt expect such interest from everyone).

If your thinking of such things I can post the corrected code segments for SR. But you still need to download the SDK to install the SR engine from microsoft. Microsoft also has "MSM"s (if i got the abreviation correct) for the core engine components for distribution of developer's software. BUt to be honest i dont know how to use them. All i know is they link into the "setup.exe" unpacking tools for distribution of software (and i have never fiddles with such things).

Anywho, if you want the source fragments I would be happy to post them.

Posted on 2003-07-06 23:22:49 by NaN