Re: Paste too fast
From: Jean-Pierre Lamon (gipi_removeme_at_ngscan.com)
Date: 11/21/03
- Next message: Ben Hochstrasser [FF]: "Re: mapping a network drive"
- Previous message: Diego Irrazabal: "mapping a network drive"
- In reply to: Tomaz Koritnik: "Re: Paste too fast"
- Next in thread: Cruxy: "Re: Paste too fast"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
> >
> >
>
>
- Next message: Ben Hochstrasser [FF]: "Re: mapping a network drive"
- Previous message: Diego Irrazabal: "mapping a network drive"
- In reply to: Tomaz Koritnik: "Re: Paste too fast"
- Next in thread: Cruxy: "Re: Paste too fast"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|