Article View: borland.public.cppbuilder.nativeapi
Article #11997Re: Paste
From: Todd Brylski
Date: Sat, 03 Jan 2004 17:49
Date: Sat, 03 Jan 2004 17:49
38 lines
2232 bytes
2232 bytes
The code _does_ work. What parts of your reply are incorrect? Todd "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:3ff625ac$2@newsgroups.borland.com... > > "Todd Brylski" <tbrylski@yahoo.com> wrote in message > news:3ff61911$1@newsgroups.borland.com... > > > HWND hWnd = ::FindWindow( 0, "untitled - notepad" ); > > FindWindow() is case-sensitive, so that should be this instead: > > HWND hWnd = ::FindWindow( 0, "Untitled - Notepad" ); > > Alternatively, you can do what Jelsma suggested - enumerate the windows, > then you don't need to worry about the window title at all. > > > ::PostMessage( hWnd, WM_COMMAND, WM_PASTE, 0 ); > > That is not correct. First, WM_PASTE is its own message, it is not part of > WM_COMMAND: > > ::PostMessage( hWnd, WM_PASTE, 0, 0 ); > > Second, you are sending the message to the wrong window. Your code found > the main Notepad window, but you need to post the message to the actual > child edit control inside that window instead. Use FindWindowEx() to get > that HWND, ie: > > HWND hEdit = FindWindowEx( hWnd, NULL, "Edit", NULL ); > if( hEdit ) > ::PostMessage( hEdit, WM_PASTE, 0, 0 ); > > > Gambit
Technical Details
Message-ID:
<3ff70083@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3ff5f6bc$2@newsgroups.borland.com> <3ff61911$1@newsgroups.borland.com> <3ff625ac$2@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,fdb8783d5e192556 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-01-03 10:09:43 PST From: "Todd Brylski" <tbrylski@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ff5f6bc$2@newsgroups.borland.com> <3ff61911$1@newsgroups.borland.com> <3ff625ac$2@newsgroups.borland.com> Subject: Re: Paste Date: Sat, 3 Jan 2004 11:49:47 -0600 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.166.145.151 Message-ID: <3ff70083@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1073152131 24.166.145.151 (3 Jan 2004 09:48:51 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail