Delphi command to control another application?
Hi,
There's a VB command (I think it's SendKey) that allows you to control another application by sending hotkeys to it (like you open TMPGEnc and your VB program can set the Video Source sending an "ALT-V" to TMPGEnc). Does anybody knows how to do the same thing with Delphi? I thougth of getting the handler of the application and putting a message in the Windows message queue using the Windows API, but that would be much easier with a single command like in VB :) Thanks. |
hI GFR.. pal..
I broke these out into TWO parts (cause they are) Also, if some of the CODE start to break-off onto other line, try and MAXimize your browser. I tried to clean up the code as much as possible, but my eyes are going cookoo.. you know 8O Note, I was SURE that Delphi had sendkey support built-in, but looks like it doesn't, though their is special D/L that does have a sendkeys unit, but I don't like registering all the time. I hope this code snipplet helps some in YOUR coding.. Well, have a look and see if it helps any, else good luck anyways.. hehe.. :) -vhelp --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- Part 1 of 2 These functions may be useful. They always send keys to the ACTIVE window. Code:
{ Peter Below (TeamB) 100113.1101@compuserve.com) No replies in private e-mail, please, unless explicitly requested! End of Part 1 of 2 } |
.
. and don't forget Part 2 of 2 here.. Note, I'm gonna include a "definition" file I got on the net on the different codes for each key and so on and so forth.. I think it's important to have this close by for your "key" referencing :wink: Remember to MAXimize your browser, in case source CODE gets snipped to other line. I know I've done this in Delphi 3. I'm sure that IT had sendkey support built-in, but my memory is slowly fading away.. Too much coding i guess.. If this is not what you are looking for (in a project) just keep on looking. I'll keep my eye out too 8O -vhelp PART 2 of 2 { The following unit is what I use, example: PostKeyEx (GetWindowsHandle("THE_CAPTION_OF_THE_WINDOW") for instructions on the rest look later on before the PostKeyEx32 procedure. There are other ways to get the window handle, but I worked this out for what I needed it. One problem could arise if you have to windows with the same caption then this will post the key to the first window with the CAPTION hope this helps } Code:
unit MyUtilsUnt; "Chris" <chris@lycos.ltd.uk> wrote in message news:3b2fac1b_1@dnews... > Can anyone give some code does a SendKey to another application assuming > you've got the hWnd for that app. > > I've tried a few PostMessage / WM_CHAR variants but really sure what all > those parameters should be. > > Thanks > > Chris > End of Part 2 of 2 } |
@ GFR..
Weather or not you can use these key codes in the list provided below, it may serve to help you w/ keys and things in other projects. This list is based on the Visual Basic list, which is what you want anyways. Good luck :!: -vhelp Code:
Supports the Visual Basic SendKeys syntax, as documented below. |
Thanks, vhelp.
I'm saving this and will try to get it working. |
Hay GFR.. :P
It's ben a long time since I last heard from you on this sendkey post. Have you gotten it working yet. If not, I do have code, ..tested and works fine, if you need it. Let me know :P Code works in my Delphi 6 projects. Other news. . . At the moment, I'm coding a front-end GUI, and just got over a bug w/ a component that allows me to drag-n drop files in my apps - fun stuff. Anyways.. I've fixed THAT bug for sure hehe.. The GUI is something I was working on for over a year now, for vcdhelp on an MPEG-2 cutter.. and up to now, I've procrastinated (other fun projects in Delphi and encoding projects) But, I basically stopped because the .exe apps and shell apps just didn't give me what I was looking for, or I just did not have the energy to complete them (many versions, sheesh) Anyways.. thanks to kvcd (strikes again) and the links here, I was able to give this project yet another go this evening.. thanks to mencoder that has ben floating around here and other forums, I think I am making some headway. I don't know.. we'll see :P -vhelp |
Quote:
|
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.