You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
'Get the current active edit control window handle
FUNCTION getEdit() AS DWORD
FUNCTION = GetDlgItem(MdiGetActive(ghWndClient), %IDC_EDIT)
END FUNCTION
I know the use of GetFocus.
But in my case it could not be used.
Because I perform an action based on mouse move and click detection that change the focus without removing the caret from the edit control.
I would like a kind of function like the WindowFronPoint but for the caret.
Indeed my problem comes from the fact that due to a postmessage from the DLL to an EXE (I can't use sendmessage) the events are not handled in the good sequence order between the DLL and the EXE.
>> Is it another program's window and caret?
No it isn't
Then maybe using HideCaret/ShowCaret (with a NUL hWnd) would work. According to Win32.HLP the ShowCaret function's return value is "nonzero" if the call works, but I've found that sometimes that means that an API returns a handle, in this case presumably the handle of the window with the caret. Or maybe it's the handle of the caret itself, and you could use GetParent or GetWindow to get the parent window? I'm just guessing... Maybe the return value is just a meaningless "1". It's worth trying anyway, but if it works be sure test it on all versions of Windows.
Eric --
Unlike Patrice, it's not clear for me your idea about GetCaretPos and ChildWindowFromPoint.
GetCaretPos returns client coordinates of edit box.
ChildWindowFromPoint requires client's coordinates of parent window for this edit box.
Patrice --
Try to do following
1) Press Alt-O. You will see (1, 1)
2) Tab (to second edit box). Alt-O. Also (1, 1)
How can you recognize edit box 1 or 2, when button has a focus ?!
Code:
#Compile Exe
#Dim All
#Register None
#Include "win32api.inc"
CallBack Function OkProc
Dim pt As PointApi
GetCaretPos pt
MsgBox Str$(pt.x) + Str$(pt.y)
End Function
Function PbMain
Local hDlg As Long
Dialog New %HWND_DESKTOP, "", , , 400, 200, %WS_CAPTION Or %WS_SYSMENU To hDlg
Control Add TextBox, hDlg, 101, "", 5, 10, 300, 80
Control Add TextBox, hDlg, 102, "", 5, 100, 300, 80
Control Add Button, hDlg, 103, "&Open", 320, 10, 70, 15 Call OkProc
Dialog Show Modal hDlg
End Function
>>How can you recognize edit box 1 or 2, when button has a focus ?!
Of course you can't because the caret is hidden as soon as the button gets the focus.
But this was not my case.
In my WinLIFT "Skin Engine" I can have hot spots, which the user can click on without removing the caret from an edit control.
Hot spots looks like buttons but they are not, for example the icon found at the top left corner on most program caption could be considered as a hot spot that won't remove the focus from an edit control, even if it fires a popup menu.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment