Page 1 of 1
Posted: Tue Feb 11, 2003 8:40 pm
by BackupUser
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...
Posted: Tue Feb 11, 2003 10:04 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
r=GetFocus_() ; r = handle of the gadget with the focus.
Posted: Tue Feb 11, 2003 11:53 pm
by BackupUser
Restored from previous forum. Originally posted by Revolver.
*RichEdit is a pointer to the currently used rich edit, although it doesn't tell you if it has focus or not
Posted: Wed Feb 12, 2003 12:31 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.
Originally posted by PB
r=GetFocus_() ; r = handle of the gadget with the focus.
Nop, dosent work.
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)
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...
Posted: Wed Feb 12, 2003 1:12 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.
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)
Thanks!!
Best Regards
Ricardo
Dont cry for me Argentina...
Posted: Wed Feb 12, 2003 2:24 am
by BackupUser
Restored from previous forum. 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...
Posted: Wed Feb 12, 2003 2:33 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.
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...
Because it dosent works in that way.
The handle must be the handle of RichEdit.
Best Regards
Ricardo
Dont cry for me Argentina...
Posted: Wed Feb 12, 2003 8:26 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> The handle must be the handle of RichEdit.
Sorry Ricardo, I misunderstood -- I thought Hnd was the handle of
the RichEdit. My mistake!

Posted: Wed Feb 12, 2003 4:18 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.
Best Regards
Ricardo
Dont cry for me Argentina...