Jump to content
Sign in to follow this  
dragonlord

WinGetCaretPos not working ?

Recommended Posts

dragonlord

Hi,

I'm writing an intellisense kinda tool (backgroung running). For this, i need to get the current Cursor Position (Not mouse cursor) in the foreground window, and it'll be in that position that i'll be showing my Intellsense Drop-Down box.

This is the code

$CursorPos = WinGetCaretPos()
$retval=WinMove("6Sense","",$CursorPos[0],$CursorPos[1])

and form is created as :

$Form1 = GUICreate("6Sense", 282, 150, 371, 248, BitOR($WS_SYSMENU,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS,$DS_MODALFRAME,$DS_SETFOREGROUND), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))

I tried

Opt ("CaretCoordMode",0)
Opt ("CaretCoordMode",1)
Opt ("CaretCoordMode",2)

nio matter what, the co-ordinates returned by WingetCaretPos are always the same(i.e, they are not retirning the correct pos).

Someone knows what i'm doing wrong here ?

Share this post


Link to post
Share on other sites
Stumpii

Did you try the example in the help file for 'WinGetCaretPos '?

The help file does warn that: 'Note: Some applications report static coordinates regardless of caret position!'

What program are you trying to determine the caret position in?


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites
dragonlord

i ran the script from Scite, move the caret to some corner, but still the code showed me some other position

Share this post


Link to post
Share on other sites
Stumpii

i ran the script from Scite, move the caret to some corner, but still the code showed me some other position

Then your app may be one of those that reports a static position. What is the program?


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×