Re: Paste too fast

From: Jean-Pierre Lamon (gipi_removeme_at_ngscan.com)
Date: 11/21/03


Date: Fri, 21 Nov 2003 00:32:55 +0100

Hi Tomaz,

Thanx for your reply. I know, sorry, it's not really clear (my poor english
maybe:-)

My external application has a window. Empty. On that window (not my
application), I can create a TMemo using shortcuts (ctrl+shift+A). In that
TMemo, I have to write some datas from a record (about 10 fields, so 10
Memos to create at runtime). So, I copy one field on the clipboard through a
TStringList:

Memo2.SelectAll;
Memo2.CopyToClipBoard;

Then I create the Memo.
I use:

 DownKey(VK_CONTROL);
  DownKey(VK_SHIFT);
  DownKey(Ord('A'));
  UpKey(Ord('A'));
  UpKey(VK_SHIFT);
  UpKey(VK_CONTROL);

Upkey, DownKey procedure :

procedure DownKey(K: Integer);

begin
  keybd_event(K, MapVirtualkey(K, 0), 0, 0);
end;

procedure UpKey(K: Integer);
begin
  keybd_event(K, MapVirtualkey(K, 0), KEYEVENTF_KEYUP, 0);
end;

After that, my TMemo is created (Memo1). My datas are on the clipboard. I
use wm_paste to... paste the datas in the new created Memo1.

It quite always works. But sometimes not. If the datas to paste are too
big, my program goes on, creates a new Memo (Memo2), and the datas are
pasted in Memo2, not in Memo1.

What I want (would like) :
- copy the first field on the clipboard
- create Memo1 in the external application using shortcuts
- paste the datas from the clipboard in Memo2
- wait until its done --> that's my problem : now, I use a sleep (400), and
I don't like this QAD solution
- copy the next field on the clipboard
-create Memo2
- paste the next datas
- etc...

That's my problem :-)

Regards
JP

> Hi
>
> If I understand then you're problem is that sometimes you get the data
> before the new memo is created. I don't know why this happens. But why do
> send message two times, one for memo creation and one for data paste. Try
to
> send WM_PASTE only and when program receives data, it creates memo and
> pastes data into it. This will always work and should be no confusion.
Also,
> what do you mean by "create memo by sending some shortcuts"? I understand
> this as: you are sending a message to window to inform it to create new
memo
> control. Maybe it's something wrong in the target app which creates memos
so
> that app sometimes pastes data into wrong memo.
>
> regards,
> Tomaz
>
>
> "Jean-Pierre Lamon" <gipi_removeme@ngscan.com> wrote in message
> news:3fbd035f@newsgroups.borland.com...
> > Hi all,
> >
> > I'm gonna try to be comprehensible :-)
> > I have an application that must copy some datas from a db into a set of
> > TMemo in another application.
> > I can find the external window with
> > WndName := 'MARC editor';
> > Wnd := FindWindow('TeditorWindow', PChar(WndName));
> > wnd := GetFocused(wndName);
> >
> > Then, I can create a new TMemo in this external window sending some
> > shortcuts.
> > The new TMemo is created and empty. And I want to fill it with my DB's
> > datas.
> >
> > WndChild := FindWindowEx(FindWindow('TeditorWindow',
PAnsiChar(WndName)),
> 0,
> > 'TMemo', PAnsiChar(''));
> >
> > I fetch my DB, and datas are copied into the clipboard. I then paste
them
> > sending a:
> > SendMessage(wndChild, wm_paste, 0, 0);
> >
> > The datas are copied, it's ok. But sometimes, not in the right place. A
> new
> > TMemo is created before the datas are pasted. And the datas are pasted
in
> > this new TMemo, not the pred one. What can I do to make my application
> wait
> > for datas being well pasted before launching a new TMemo creation.
> >
> > Thx in advance
> >
> >
>
>



Relevant Pages

  • Re: Paste too fast
    ... one for memo creation and one for data paste. ... that app sometimes pastes data into wrong memo. ... > I have an application that must copy some datas from a db into a set of ... > TMemo in another application. ...
    (borland.public.delphi.nativeapi)
  • Paste too fast
    ... I have an application that must copy some datas from a db into a set of ... TMemo in another application. ... Wnd:= FindWindow); ... I can create a new TMemo in this external window sending some ...
    (borland.public.delphi.nativeapi)
  • Re: partipert my hard drive
    ... | currently i use window xp, but i want to participate my hard drive without ... | loosing my current datas how can i do this? ... Your mileage may vary. ...
    (microsoft.public.windowsxp.hardware)
  • Re: partipert my hard drive
    ... >> currently i use window xp, but i want to participate my hard drive without ... >> loosing my current datas how can i do this? ... Prev by Date: ...
    (microsoft.public.windowsxp.hardware)
  • Re: partipert my hard drive
    ... > currently i use window xp, but i want to participate my hard drive without ... > loosing my current datas how can i do this? ... or PartitionExpert from Acronis. ...
    (microsoft.public.windowsxp.hardware)