position form over another form at precise location
I have 2 forms -
Form1 calls the second form, Form2
I'm trying to position the second form at the exact location of the caret. I already have that position using GetCaretPos api. Only problem is that the form does not position itself at the location I have given. Any ideas why?
partial code below:
VB Code:
' here is the caret position retreived
GetCaretPos pt
XPos = pt.x
YPos = pt.y
' call this first
SetParent Form2.hwnd, Form1.hwnd
' tell the form where to move
Form2.Move XPos, YPos
' telling form that Main form is the parent
Form2.Show vbModal, Form1
FYI -
It seems if I make a call to SetParent api - it works as expected...