Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by David Goodman
Mon, 12 May 2003 20:39
keybd_event(...) or a way to do Edit-Paste
Author: David Goodman
Date: Mon, 12 May 2003 20:39
Date: Mon, 12 May 2003 20:39
21 lines
1456 bytes
1456 bytes
Hi,
I have a program that runs Paint (..\System32\mspaint.exe)
and then pastes a graph I have in the Windows Clipboard
to it. I am using:
hWnd=FindWindow("MSPaintApp", NULL);
BringWindowToTop(hWnd);
an then keybd_event(...); to push
keys in Paint's menu (Edit-Paste) but this method
doesn't work well sometimes, also if Paint's menu
is in other language other than English it
won't work.
Is there other direct way to do this with APIs?
A snip on how to do this would be appreciated.
Dave
Re: keybd_event(...) or a way to do Edit-Paste
Author: JD
Date: Tue, 13 May 2003 13:57
Date: Tue, 13 May 2003 13:57
26 lines
1914 bytes
1914 bytes
"David Goodman" <dgoodman@nospam.com> wrote: > [...] then keybd_event(...); to push keys in Paint's menu > (Edit-Paste) but this method doesn't work well sometimes, > also if Paint's menu is in other language other than English > it won't work. > > Is there other direct way to do this with APIs? As best as I can tell, you can't do it the way that you're looking at with using APIs without knowing more about the internals of Paint. Someone in the graphics news group might be able to help you with this. There are however 2 other options that come to mind. The first is to save the image to disk and pass the filename to Paint so that it loads it on startup. The second is just an idea that may not be do-able - to use API calls to access the Menus (assuming that they will always be the same or at least consistant enough to be able to determine that you're looking at the correct menu item) and then determine the key sequence to push or simulate mouse clicks on the desired menu item. ~ JD
Re: keybd_event(...) or a way to do Edit-Paste
Author: Timothy H. Buchman
Date: Tue, 13 May 2003 14:45
Date: Tue, 13 May 2003 14:45
19 lines
1920 bytes
1920 bytes
David Goodman <dgoodman> wrote in message news:3ec00699$1@newsgroups.borland.com... > an then keybd_event(...); to push > keys in Paint's menu (Edit-Paste) but this method > doesn't work well sometimes, also if Paint's menu > is in other language other than English it > won't work. Although it's more work, you can stuff [Ctrl] combinations keys. Doesn't [Ctrl]+[V] appear next to Edit|Paste in the other-language versions of Paint? You could use that, instead of the underlined letter that changes with languages. I don't see any need to pull down the menu at all. -- Timothy H. Buchman ======================================== City Center Theater, New York NY mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org Search .borland message archive on http://www.mers.com/searchsite.html
Re: keybd_event(...) or a way to do Edit-Paste
Author: JD
Date: Tue, 13 May 2003 15:12
Date: Tue, 13 May 2003 15:12
8 lines
1189 bytes
1189 bytes
"Timothy H. Buchman" <tbuchmanPLEASE(at sign)REMOVEcitycenter.org> wrote: > [...] You could use that, instead of the underlined letter > that changes with languages. It never accured to me that he wasn't pushing Ctrl_V. Good catch. ~ JD
Re: keybd_event(...) or a way to do Edit-Paste
Author: Remy Lebeau (TeamB)
Date: Tue, 13 May 2003 16:44
Date: Tue, 13 May 2003 16:44
11 lines
1283 bytes
1283 bytes
"David Goodman" <dgoodman@nospam.com> wrote in message news:3ec00699$1@newsgroups.borland.com... > Is there other direct way to do this with APIs? Since you already have the HWND to Paint's window, you could try simply sending it a WM_PASTE message directly. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads