Prev: System.IO.File.Exists in Windows 7
Next: How to Make a .NET Timer Always Fire at the Right Time
From: mayayana on 1 Nov 2009 18:07 I tried your approach and it does act very strangely. The focus does not act as expected. But then I tried a system keyboard hook and chose a random combination: ALT+CTRL+A In the hook function I watched for that combination and then sent CTRL+INS and copied the clipboard text. It seems to work fine. Using that method you would just have people start your program, your program would set the hook, then the person would type your specified combination (like ALT+CTRL+A) instead of pushing a button in your program. If you are not familiar with keyboard hooks you can look that up. You should be able to find a small, free keyboard hook DLL that you can use to report all keyboard input to any hWnd in your program. The only catch is that you need to trap errors because sometimes with the focus changing the clipboard is momentarily locked.
From: Nobody on 1 Nov 2009 20:14 "ptpwjp" <ptpwjp(a)op.pl> wrote in message news:hckoil$k5n$1(a)news.onet.pl... > In my program is instruction: > SendKeys.Send("%{TAB}^{INS}%+{TAB}") It's preferable to send WM_COPY than trying to send Ctrl+C, or Shift+Insert keys. This copies the text to the clipboard, but you need to specify the correct window handle. Also, what do you want to do once you have the text? There are free dictionary tools that lets you select text in any program or web page, then right click to get translation. This is a complicated task, even if you already know how to use VB, and in many cases require you that you make unmanaged standard DLL in C++, then use it in VB. I have done something close, but it was not easy.
From: ptpwjp on 2 Nov 2009 05:01 >> 2. ^{INS} copy selected text to box(?)- where- I >> haven't word in my mind >> now,write it to me; > > You mean the Clipboard? The Clipboard is where > Ctrl+Insert sends the selected text. You realize > that you need to get the text from the Clipboard > after you do Ctrl+Insert? In my language it is something like box, or casket, in dictionary English - my language "clip" it is small wire using to have a lot of pages together. But I think it is it. >> So how can I get text from box to my variable in my VB2008 application? >> > I understood the Sendkeys > isn't working the way you want it to. No , Sendkeys work very good. But it isn't enough to me. > It sounds > like you need to try it outside of the debugger. (?) Yes, yesterday was Sunday , and I haven't time to test it outside debugger. Today I will test it more. But test isn't enough for me, because I can't get text from box (clipboard?) to variable in my application.
From: ptpwjp on 2 Nov 2009 05:05 >> In my program is instruction: >> Send("%{TAB}^{INS}%+{TAB}") > > It's preferable to send WM_COPY than trying to send Ctrl+C, or > Shift+Insert keys. This copies the text to the clipboard, but you need to > specify the correct window handle. I will test it, I don't use clipboard object yet, I think if I start use it I will be home. > Also, what do you want to do once you have the text? There are free > dictionary tools that lets you select text in any program or web page, > then right click to get translation. No, I don't want translate it. I want to transform it.
From: ptpwjp on 2 Nov 2009 05:07
U�ytkownik "mayayana" <mayaXXyana(a)rcXXn.com> napisa� w wiadomo�ci news:%23J1Jof0WKHA.3720(a)TK2MSFTNGP04.phx.gbl... > I tried your approach and it does act very > strangely. The focus does not act as > expected. But then I tried a system keyboard > hook and chose a random combination: > ALT+CTRL+A > > In the hook function I watched for that > combination and then sent CTRL+INS > and copied the clipboard text. It seems > to work fine. Using that method you would > just have people start your program, your > program would set the hook, then the > person would type your specified combination > (like ALT+CTRL+A) instead of pushing a > button in your program. It is a future of cause. |