Yofoo
just set position of cursor in edit, Other way except CharFromPos
you can use mouse_event(SendInput) to click edit
also you can sendmessage(mouse message) to edit
example:
xxxxxx()
{
POINT pt;
GetCursorPos(&pt);
NSys::InputMouseClick(pt.x, pt.y, 0, TRUE);
Sleep(10);
NSys::InputMouseClick(pt.x, pt.y, 0, FALSE);
}
BOOL NSys::InputMouseClick(int x, int y, int nButton, BOOL bDown)
{
INPUT input;
BOOL bRetVal;
int nScrW, nScrH;
nScrW = GetSystemMetrics(SM_CXSCREEN);
nScrH = GetSystemMetrics(SM_CYSCREEN);
x = (x)*(65536-1)/(nScrW-1);
y = (y)*(65536-1)/(nScrH-1);
input.type = INPUT_MOUSE;
input.mi.dwExtraInfo = NULL;
input.mi.dx = x;
input.mi.dy = y;
input.mi.mouseData = 0;
input.mi.time = GetTickCount();
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE;
switch(nButton)
{
case 0: input.mi.dwFlags |= bDown ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; break;
case 1: input.mi.dwFlags |= bDown ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP; break;
case 2: input.mi.dwFlags |= bDown ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP; break;
default: assert(0); return FALSE;
}
bRetVal = SendInput(1, &input, sizeof(input));
return bRetVal;
}