winapi and Jna
-
I repost the link of my question here, how to use SendMessage in Java[^] Thanks and Best regards,
GetWindowText()
will return the title of a window, unless that window specifically returns other information on receipt of aWM_GETTEXt
message. You cannot get the text at a particular mouse position unless the window itself has some mechanism for providing it. The characters displayed on the screen are merely coloured pixels and have no direct relationship to the actual characters; that information is held within the program that owns the window.The best things in life are not things.
-
GetWindowText()
will return the title of a window, unless that window specifically returns other information on receipt of aWM_GETTEXt
message. You cannot get the text at a particular mouse position unless the window itself has some mechanism for providing it. The characters displayed on the screen are merely coloured pixels and have no direct relationship to the actual characters; that information is held within the program that owns the window.The best things in life are not things.
hi Richard MacCutchan Thanks for quick respone, follow up your message "The characters displayed on the screen are merely coloured pixels and have no direct relationship to the actual characters; " that we only can get the word at the mouse cursor by OCR. have you got any ideas for get the rectangle bounds the text under the mouse. Thanks and Regards,
-
hi Richard MacCutchan Thanks for quick respone, follow up your message "The characters displayed on the screen are merely coloured pixels and have no direct relationship to the actual characters; " that we only can get the word at the mouse cursor by OCR. have you got any ideas for get the rectangle bounds the text under the mouse. Thanks and Regards,
sharkbc wrote:
we only can get the word at the mouse cursor by OCR. have you got any ideas for get the rectangle bounds the text under the mouse.
Unfortunately no, you would have to have some code to detect the boundaries of characters within the window and somehow figure out what they are. This is certainly not something that can be done easily, as you have no real points of reference, since the start and end points of each line of text may not necessarily even be shown on the screen, if the view has been scrolled in any direction. It may be that you need to reconsider exactly what you are trying to do here.
The best things in life are not things.
-
sharkbc wrote:
we only can get the word at the mouse cursor by OCR. have you got any ideas for get the rectangle bounds the text under the mouse.
Unfortunately no, you would have to have some code to detect the boundaries of characters within the window and somehow figure out what they are. This is certainly not something that can be done easily, as you have no real points of reference, since the start and end points of each line of text may not necessarily even be shown on the screen, if the view has been scrolled in any direction. It may be that you need to reconsider exactly what you are trying to do here.
The best things in life are not things.
Hi Richard MacCutchan, It would be better that i show you what i need bellow: My final question is: get text under mouse pointer As you know at the begining i wanna to do this with maximum support from winapi, but as your message winapi can not help all for this task. That's the reseon why I try to do this with one or some support from winapi (instead of thinking winapi can help me to do all for this). It makes me thinking about "how to get the rectangle from mouse point" and do OCR with this information. I got some information from this link before i've post this question at Project.com: http://stackoverflow.com/questions/3877762/get-the-word-under-the-mouse-cursor-in-windows/3877807#3877807 I see some dictionary software did this with click and see (Babylon, ...) Can anybody explain me how they do that or any other solution to make thing posiple? Thanks and Regards,
-
Hi Richard MacCutchan, It would be better that i show you what i need bellow: My final question is: get text under mouse pointer As you know at the begining i wanna to do this with maximum support from winapi, but as your message winapi can not help all for this task. That's the reseon why I try to do this with one or some support from winapi (instead of thinking winapi can help me to do all for this). It makes me thinking about "how to get the rectangle from mouse point" and do OCR with this information. I got some information from this link before i've post this question at Project.com: http://stackoverflow.com/questions/3877762/get-the-word-under-the-mouse-cursor-in-windows/3877807#3877807 I see some dictionary software did this with click and see (Babylon, ...) Can anybody explain me how they do that or any other solution to make thing posiple? Thanks and Regards,
Look at it this way. The user clicks the mouse somewhere on the screen, which is displaying some text characters. Given that mouse position how can you figure out: 1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left? 2. How big the character is; height, width, leading, overhang? 3. Has the character been rotated, is it bold or italic? etc. The best way to manage this would be to capture the entire visible portion of the window that the mouse is within and pass that image through some existing OCR package to try and convert it to text. However, this will still not guarantee that you will get the final result you are looking for.
The best things in life are not things.
-
Look at it this way. The user clicks the mouse somewhere on the screen, which is displaying some text characters. Given that mouse position how can you figure out: 1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left? 2. How big the character is; height, width, leading, overhang? 3. Has the character been rotated, is it bold or italic? etc. The best way to manage this would be to capture the entire visible portion of the window that the mouse is within and pass that image through some existing OCR package to try and convert it to text. However, this will still not guarantee that you will get the final result you are looking for.
The best things in life are not things.
Hi Richard MacCutchan For sure your answer is correct but it is just only in theory. I need what api or sample code to do this. " 1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left? 2. How big the character is; height, width, leading, overhang? 3. Has the character been rotated, is it bold or italic? etc. The best way to manage this would be to capture the entire visible portion of the window that the mouse is within " Thanks and Regards,
-
Hi Richard MacCutchan For sure your answer is correct but it is just only in theory. I need what api or sample code to do this. " 1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left? 2. How big the character is; height, width, leading, overhang? 3. Has the character been rotated, is it bold or italic? etc. The best way to manage this would be to capture the entire visible portion of the window that the mouse is within " Thanks and Regards,
sharkbc wrote:
I need what api or sample code to do this.
Obviously I am not getting through to you. There is no API or sample code, you will have to write it for yourself. I have been trying to point out some of the issues you will need to solve in order to develop this application.
The best things in life are not things.
-
sharkbc wrote:
I need what api or sample code to do this.
Obviously I am not getting through to you. There is no API or sample code, you will have to write it for yourself. I have been trying to point out some of the issues you will need to solve in order to develop this application.
The best things in life are not things.