Restored from previous forum. Originally posted by ricardo.
Hi,
Im pasting a lines to the editor, but i cant get which of the possible RichEdits (supoussing that the user has more than one code displayed) has the focus.
I tried ChildWindowFromPoint and EnumChildProc and i get the handles okay, but how to know which one is the one with focus?
Best Regards
Ricardo
Dont cry for me Argentina...
How to know which RichEdit has focus on the Editor
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
I try this one before but gives me always the handle of the first RichEdit, not the active one.
Im coding an external application that stays on the systray and i want that when i call this app paste some lines to the code that i have active in the Editor, no matters that i have more codes opened on the Editor.
In fact if the calling thread's message queue does not have an associated window with the keyboard focus, the return value is NULL.
I tried to associate both threads
But it dosent gives me the handle of the RichEdit so the paste fails, i get some strange handle... i will try to find which handle is it returning me
Best Regards
Ricardo
Dont cry for me Argentina...
Nop, dosent work.Originally posted by PB
r=GetFocus_() ; r = handle of the gadget with the focus.
I try this one before but gives me always the handle of the first RichEdit, not the active one.
Im coding an external application that stays on the systray and i want that when i call this app paste some lines to the code that i have active in the Editor, no matters that i have more codes opened on the Editor.
In fact if the calling thread's message queue does not have an associated window with the keyboard focus, the return value is NULL.
I tried to associate both threads
Code: Select all
Hnd.l = FindWindow_("WindowClass_0","PureBasic")
Active = ChildWindowFromPoint_(Hnd,WindowX()+100,WindowY()+200)
Otra = GetWindowThreadProcessId_(Hnd,0)
Mia = GetCurrentThreadId_()
result = AttachThreadInput_(Mia,Otra,-1)
r=GetFocus_()
SendMessage_(r,#WM_PASTE,0,0)
AttachThreadInput_(Mia,Otra,0)
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Im so idiot!!
Now its working... missing give foreground to the window
Thanks!!
Best Regards
Ricardo
Dont cry for me Argentina...
Im so idiot!!
Now its working... missing give foreground to the window
Code: Select all
Hnd.l = FindWindow_("WindowClass_0","PureBasic")
Active = ChildWindowFromPoint_(Hnd,WindowX()+100,WindowY()+200)
Otra = GetWindowThreadProcessId_(Hnd,0)
Mia = GetCurrentThreadId_()
result = AttachThreadInput_(Mia,Otra,-1)
SetForegroundWindow_(Hnd)
r=GetFocus_()
SendMessage_(r,#WM_PASTE,0,0)
AttachThreadInput_(Mia,Otra,0)
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
The handle must be the handle of RichEdit.
Best Regards
Ricardo
Dont cry for me Argentina...
Because it dosent works in that way.Originally posted by PB
> SetForegroundWindow_(Hnd)
> r=GetFocus_()
> SendMessage_(r,#WM_PASTE,0,0)
Why can't you shorten the above to:
SendMessage_(Hnd,#WM_PASTE,0,0)
Why use r=GetFocus_() ? r = Hnd anyway due to SetForegroundWindow...
The handle must be the handle of RichEdit.
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm