Hi, You might want to look into pyHook (google for it - I don't have a link right now).
Another option that might be much easier is to setup a global hotkey, where the user selects the word, and clicks the hotkey (and you pop up a window at that point with the translation(s). You could probably use WM_COPY to get teh text into teh clipboard and then get it from there using your app (though it would be good manners to save teh existing data first :-) ). Mark On 4/18/06, Tim Roberts <[EMAIL PROTECTED]> wrote: > On Mon, 17 Apr 2006 19:54:14 +0200, Dao Duy Huy <[EMAIL PROTECTED]> wrote: > > >I'm writing a dictionary german <> vietnamese for free use, which > >should react on the mouse-click like babylon. > >You click on a german word in any win-program and the dict program will > >show you the translation in vietnamese and vice versa. > > > >But i couldn't find the way how i can select the word with the mouse > >position... > > > >Can you show me how you solve the problem? > > > > > This is a difficult problem to solve, and it may be that Python is not > the right language for it. > > You first have to figure out which window contains the point you want. > Then, you have to figure out what KIND of window that is (text box, rich > text control, static text, list box, custom control). Then, you use > THAT knowledge to decide how to ask the control to translate the X,Y > coordinate into a row and column position. Then, you can fetch the > whole contents of that window, find the exact character, and work > backwards and forwards to find the word boundaries. Note that for some > applications (like Word), you will have to use Word APIs to do this. > > It is complicted. You will want to do a lot of web searching to see if > you can find some good sample code. > > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32