Can SWT get the location of the blinking cursor in windows
I'm a beginner in java programming and I want to get location of the blinking cursor in Windows not in Java windows. How to get it? Does Java have any API to do it?
I tried this code, but it gets the current mouse cursor.
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
public class CursotLocationDemo{
public static void main(String[] args){
Display d = new Display();
while(true){
Point p = d.getCursorLocation();
System.out.println("Cursor location is: " + p);
try{ Thread.sleep(200); } catch (InterruptedException e) {}
}
}
}
The goal is to get the cursor in another application like Notepad or another text editor.
You may be able to call the Windows GetCursorPos
function as outlined in these threads:
上一篇: 获取webview光标位置
下一篇: SWT可以获取窗口中闪烁光标的位置