Get text from anather application

 want to get to copy or get the selected text from internet explorer
i use this code to get the hWnd

HWND FgHwnd=GetForegroundWindow();


DWORD lpdwProcessId;
DWORD td=GetWindowThreadProcessId(FgHwnd,&lpdwProcessId);


AttachThreadInput(td,GetCurrentThreadId(),TRUE);


HWND awnd=GetFocus();


and then i use SendMessage to copy the text


char buffer[256] = {0};
SendMessage(awnd, WM_COPY,255, (LPARAM)&buffer);


its works fine if the application has a simple edit or rich edit box.
but i when i want to get the text from internet explorer it doesnt
work. 


Please help me 
natanr123@vfemail.net

0
natanr123 (8)
12/4/2006 7:25:05 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
1362 Views

Similar Articles

[PageSpeed] 52

That's because WM_COPY  only works for Edit and combobox controls.

You might want to send a Ctrl+C using SendInput(...).

AliR.


"natanr123" <natanr123@vfemail.net> wrote in message
news:1165260305.731834.219550@73g2000cwn.googlegroups.com...
> want to get to copy or get the selected text from internet explorer
> i use this code to get the hWnd
>
> HWND FgHwnd=GetForegroundWindow();
>
>
> DWORD lpdwProcessId;
> DWORD td=GetWindowThreadProcessId(FgHwnd,&lpdwProcessId);
>
>
> AttachThreadInput(td,GetCurrentThreadId(),TRUE);
>
>
> HWND awnd=GetFocus();
>
>
> and then i use SendMessage to copy the text
>
>
> char buffer[256] = {0};
> SendMessage(awnd, WM_COPY,255, (LPARAM)&buffer);
>
>
> its works fine if the application has a simple edit or rich edit box.
> but i when i want to get the text from internet explorer it doesnt
> work.
>
>
> Please help me
> natanr123@vfemail.net
>


0
AliR3470 (3236)
12/4/2006 8:05:36 PM
Is there another way to do that
I have a problem with the INPUT structure
its undeclared because of some reason

0
natanr123 (8)
12/4/2006 8:17:39 PM
"natanr123" <natanr123@vfemail.net> wrote in message
news:1165263459.048776.164130@n67g2000cwd.googlegroups.com...
> Is there another way to do that

Not that I know of.

> I have a problem with the INPUT structure
> its undeclared because of some reason
>

To get things working, open your stdafx.h and change the define _WIN32_WINNT
from 0x0400 to 0x0410


AliR.


0
AliR3470 (3236)
12/4/2006 8:21:28 PM
This makes a couple unwarranted assumptions:

(a) the target app supports WM_COPY
(b) all the text can be represented in 8-bit characters.

You should be using the automation interfaces for this purpose.  And they would typically
assume Unicode.

Think of 'char' as a quaint data type from ancient history that is used in very rare and
exotic situations.  Otherwise, it should be thought of as an obsolete concept.  TCHAR,
LPTSTR, LPCTSTR, and CString should be your data types of choice.  Always think Unicode.
					joe
On 4 Dec 2006 11:25:05 -0800, "natanr123" <natanr123@vfemail.net> wrote:

> want to get to copy or get the selected text from internet explorer
>i use this code to get the hWnd
>
>HWND FgHwnd=GetForegroundWindow();
>
>
>DWORD lpdwProcessId;
>DWORD td=GetWindowThreadProcessId(FgHwnd,&lpdwProcessId);
>
>
>AttachThreadInput(td,GetCurrentThreadId(),TRUE);
>
>
>HWND awnd=GetFocus();
>
>
>and then i use SendMessage to copy the text
>
>
>char buffer[256] = {0};
>SendMessage(awnd, WM_COPY,255, (LPARAM)&buffer);
>
>
>its works fine if the application has a simple edit or rich edit box.
>but i when i want to get the text from internet explorer it doesnt
>work. 
>
>
>Please help me 
>natanr123@vfemail.net
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
12/4/2006 9:03:44 PM
Thaks for the help

I tried the SendInput and i could see it sends the keys (with spy)
But it didnt work (not even with simple edit control)

INPUT input[4] ;
    ZeroMemory( input, sizeof(input) ) ;
    input[0].type = input[1].type =
        input[2].type = input[3].type = INPUT_KEYBOARD ;
    input[0].ki.wVk = input[3].ki.wVk = VK_CONTROL ;
    input[1].ki.wVk = input[2].ki.wVk = 'c' ;
    input[2].ki.dwFlags = input[3].ki.dwFlags = KEYEVENTF_KEYUP ;
    input[0].ki.time = input[1].ki.time =
        input[2].ki.time = input[3].ki.time = GetTickCount() ;
    SendInput( 4, input, sizeof(INPUT) ) ;

The way i run my program is like this
I have a very simple api program that doesnt even start  the WinProc
(so doesnt steal foucs)
and i made a shortcut to the desktop and attached to hotkey to it (ctrl
+alt+ y)
and then i get the hwnd of the active window and SendInput

if you have any idea how can i make this work

0
natanr123 (8)
12/4/2006 10:22:59 PM
Reply:

Similar Artilces:

Get Pivot Table Data Formula
Is anyone a Pivot Table Guru? I need to use the GetPivotData formula to get a subtotal line within the Pivot, but when I use the equals I keep getting a reference error! eg. Need to access Sep Hrs - cannot get total as I receive a ref error. But for Total hrs I can use the formula!! Is there a way I can use the getpivotdata formula or another formula to access these category subtotals from the pivot table!! The pivot table is dynamic aswell, and its range grows as you add in additional weeks.. Help!! There are example GetPivotData formulas in Excel's Help. Can you base your fo...

Message Rules are getting added but not applied
I have recently switched to Outlook 2007 from Windows-Mail (WM). One of my beefs is, adding/creating message rules seems much more complicated in Outlook than in WM. For example, I don't understand things like "Stop processing more rules" whose check-box gets automatically checked when I check the "Permanently delete it" check-box. But the BIG problem I'm having right now is that I'm creating rules okay (and can see they've been added when I list them via Message Rules), but they're not getting applied some if not all of the time - email...

how do I get more than one sub-total in pivot tables?
I am using pivot tables to show summary HR recruiting data. The data columns are nested at three levels - priority(a, b or c), type(add/replace), number of reqs and number of positions. The pivot table automatically gives me sub-totals within the priority so I get number of reqs that are adds of priority A for example. I also automatically get a total of number of reqs and total of number of positions. What I'm trying to get is the sub-total of number of reqs that are adds regardless of priority. Move Type to the column area, and you'll get columns with totals for Add and...

How do I change the case of my text to proper?
My entire spreadsheet is in all caps but I need it to be proper. Example: This is how it looks now: KERRY THOMAS 123 ANY STREET ANYTOWN, GA 12344 I need it to be: Kerry Thomas 123 Any Street Anytown, GA 12344 The syntax is =proper(Cell_Number) Hope this helps you. rayshonf Wrote: > My entire spreadsheet is in all caps but I need it to be proper > Example: > > This is how it looks now: > > KERRY THOMAS > 123 ANY STREET > ANYTOWN, GA 12344 > > I need it to be: > > Kerry Thomas > 123 Any Street > Anytown, GA 1234 -- BenjieLo --------------...

Getting sick of Office 2007 fatal errors...
Every so often MSWord 11 or Excel or PPoint dies upon starting the app. I have a legit Office 07 Ultimate version, installed in a new PC with Vista x64. Initially I decided to upgrade to Windows 7, but frequent freezes continue to happen. All products are updated. Usually the killer is the ** ntdll.dll ** module. Any MS brilliant idea? This is my last error event: Log Name: Application Source: Application Error Date: 5/14/2010 8:36:31 PM Event ID: 1000 Task Category: (100) Level: Error Keywords: Classic User: N/A Computer: ...

Adjust Row Height for Text
I am working on a worksheet, and I have a row that contains text that I want to restrain in length so the text automatically wraps around and starts a new line within the row. I've tried "help" in Encel, but I can't figure how to do this. I want a wrap around in the row, because I don't want the text to exceed the limits of the paper when the worksheet is printed out. Any help would be appreciated. Pedro -- To contact me directly by email, please remove the words "NO" and "SPAM" from the reply address above. Alt click on the cell you want...

Missing menu item--how do I get it back?
I am trying to get the news reader feature to work within my Outlook. I have added the News item to the Go menu but it does not show up there after it started once. Noe the news item no longer show when I go to Customize|commands|Go Any help would be great on how to get it back. I have already tried a reinstall and repair but those did not help. To get the News command back, go back to the Programs tab in Control Panel | Internet Options and change the default newsreader to Outlook Express. If OE prompts you to make it your default newsreader the next time you launch it, clear the &quo...

toolbar is not getting resized while adding and removing text to buttons of toolbar
hai all, i actually created three Image lists and added bitmap array to each of them then added to toolbar as shown below-> m_wndToolBar .GetToolBarCtrl().SetImageList ( &m_ImageListToolbar ) ; wndToolBar .GetToolBarCtrl() .SetDisabledImageList ( &m_ImageListDisabledToolbar ) ; m_wndToolBar .GetToolBarCtrl() .SetHotImageList ( &m_ImageListRolloverToolbar ) ; now i was asked to remove are add text to buttons of toolbar depending on the option which is placed as a check box in the dialog. i am invoking that dialog from CWinApp derived class. for that i...

Text box displaying columns from a combo box
I'm using text boxes to display the column data from a combo box. Trouble is when I move to another record or close the form and ome back in, those results are not displayed anymore and I have to reslect the values in the combo boxes to fill in the text boxes. Is there a way to lock the results to the text box for each record? TIA -- Don, Sydney Australia Don, I take it that you have a combo bound to a field in your table. When the combo is dropped down, you see several columns, but when it's not dropped down you can see only one. Therefore you have added some other text boxe...

Prblm w/ photos ninserted in MS Word text box
I'm running Word 2004 on a Mac G5 running OS 10.4. When inserting a photo in a text box in a Word doc, some of the Picture Effects are not active.I want to add a shadow around the edge. When I click on the picture, the Picture Formatting Pallette opens, but the Shadow effect, next to "Effects" in the second row down is not active. What's going on? Mike in Atlanta On 12/20/05 5:35 PM, in article 1135118110.792146.154940@z14g2000cwz.googlegroups.com, "Mike in ATL" <mike.ventura@comcast.net> wrote: > I'm running Word 2004 on a Mac G5 running OS 10.4....

Where is the text strikethrough command in Publisher?
Please use this space to be courteous. -- Ed Bennett - MVP Microsoft Publisher You lost in this white space somewhere! ...

Can two or more functions run in one cell? I need to count text survey data..
I have thirteen different surveys with multiple questions. Three of the Q's are the same for each survey. I need to bring the answers from the 3Q's together in one table and then provide one overall graph. PLAN: I created 15 worksheets, one for the graph, one for the overall data summary, and 13 extras (one for each set of exported/imported survey data.) The survey application allows me to extract the results in text form, yet I need numbers for the totals & graphs. On the summary sheet for SUP Table in a cell by row Q1 and column A1 (answer 1) I'd like to count the numbe...

Get rid of the namespace
I've the following code: writer.WriteStartDocument(); writer.WriteStartElement("n", "Property", "http://www.aaa.com"); writer.WriteAttributeString("xmlns", "j", null, "http://www.bbb.com"); writer.WriteAttributeString("xmlns", "n", null, "http://www.aaa.com"); writer.WriteElementString("PropertyDescriptionText", "http://www.bbb.com", "hello"); string prefix = writer.LookupPrefix("http://www.aaa.com"); string prefix2 = writer.Lookup...

Simple hack to get $1000 to your home.
Simple hack to get $1000 to your home at http://latestnewsupdate.tk Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

Need a simple macro that will import any one of a number of text files in a folder
I'm having problems coming up with a macro that will allow me to import a text file of choice from my default file location that I have set up with Excel which contains several text files. I want the macro to open a "Open" file dialog window where I can then choose the text file of choice. I also need it to open the file as delimited, starting at row 23 and with the tab selected as the only delimiter. Please help... thanks, steve Steve I have been using the following for several years to obtain a spreadsheet from a .csv file downloaded from a bank. You will need to add the...

ow to create comparison chart using text as value data?
lplease help me. I am trying to set up a comparison chart of 3 computers cost and features! I cannot figure out how to use the features as values on the x or y axis says data range is to complex so cant select rows or columns. I am trying to enter the features as my source data too bungled dont know what to do term project is now overdue and I am stressing out!~ Dont want to fail. please help me!do i have to redo the whole chart or what any suggestions and demonstration would be deeply appreciated. thanks, Dee Johnson The first thing you need to do is think how the chart should look. Wh...

Outlook - Application Error
Errors come from two different machines. Symptoms are same; Outlook closes on them instantly. It doesn't occur all the time but periodically it'll happen. Outlook 2007 has two addins. 1) MSCRMAddin, 2) PST Backup Has anyone experienced something like this? All help is needed. Thanks in advance. Event Type: Error Event Source: Application Hang Event Category: (101) Event ID: 1002 Date: 20/11/2008 Time: 3:51:22 PM User: N/A Computer: ADNBK0022 Description: Hanging application OUTLOOK.EXE, version 12.0.6316.5000, hang module hungapp, version 0.0.0.0, hang address 0x00000000. F...

Runtime error 1004 application-defined or object-defined error
I tried to pose this on another group, MS Excel and VBA, but it still has not been posted, and I realize now that this group is much more active and accessible. . . . I am getting the error: "Runtime error 1004 application-defined or object-defined error" in the code provided below at this line of code: .Cells(StartRow + n - 1, 5).Value = _ WordDoc.Comments(n).Scope It is processing comments in a Word document and outputting them into Excel cells. It works fine on another document, but not on this particular document. However, the de...

When moving pst files into 2003 I get extra personal folders
I've recently upgraded to Outlook 2003 and after moving files from two previous versions of Outlook, I keep getting 2 extra personal folders added to my folder list. I can get rid of them using /cleanpst and /cleanprofile. But when I restart Outlook again the 2 personal folders are back. What to do? Your advice is appreciated. Thanks, Ken Hapa Molowa wrote: > I've recently upgraded to Outlook 2003 and after moving files from > two previous versions of Outlook, I keep getting 2 extra personal > folders added to my folder list. I can get rid of them using /cleanpst > and ...

how to get rid of DASL/SQL/DAV filter in task pane?
I use the task pane in my calendar view (Outlook 2002). I have a filter set up so that completed tasks are not shown, and this has worked fine for years. However, over the past few months, Outlook has insisted on instating a "DASL filter," the details of which show up in the SQL tab of the Filter dialog as ("DAV:isfolder" = false AND "DAV:ishidden" = false) AND ("http://schemas.microsoft.com/mapi/id/{00062003-0000-0000- C000-000000000046}/811c000b" = 0) When this filter is in effect, future instances of recurring tasks are not displayed in the ...

Changing text "A" to a number?
In cell A1 I have the either Letter a, b or c. I would like to give them a numerical value of 1, 2 and 3 in the adjacent cell. Can someone post or point me to the formula? Thanks Try this: =3DCODE(LOWER(A1))-96 Then copy down. Hope this helps. Pete On Apr 11, 5:15=A0pm, Larry <Yak...@gmail.com> wrote: > In cell A1 I have the either Letter a, b or c. > I would like to give them a numerical value of 1, 2 and 3 in the > adjacent cell. > Can someone post or point me to the formula? > Thanks One way: = CODE(UPPER(A1)) - 64 another: =MATCH(A1,{"a","...

Resource management application
Hi, I guess this has been asked before, but wondering if anyone can recommend a Resource management ( ex : Conference rooms or Projectors ) product ( 3rd party ) for Exchange 2003 SP2... A client of mine is migrating from 5.5 to 2003, and they were using an in-house script with 5.5, but it's messy and hard to maintain... I know Microsoft has the new auto-accept agent tool, but we need a bit more functionality and want to manage 50 to 100 conference rooms.. Thanks very much ! Swinc's ERM? http://www.swinc.com/products/erm/ -- Neil Hobson Exchange MVP "Thinkpad21"...

Get property values from object.
Hello. I need sample code of getting properties values of a specific object, please. Thanks :) Am 19.06.2010 15:08, schrieb Mr. X.: > Hello. > I need sample code of getting properties values of a specific object, > please. I assume that you don't know the type of the object at design time, is that right? Then you're looking for reflection: http://msdn.microsoft.com/en-us/library/cxz4wk15(VS.90).aspx See sub topic "Viewing Type Information", section "MemberInfo, MethodInfo, FieldInfo, and PropertyInfo" -- Armin Indeed, I am usin...

how to get info from outlook express to outlook
I HAVE JUST BOUGHT A NEW COMPUTER. ON MY OLD COMPUTER I WAS USING OUTLOOK EXPRESS AND NOW I WANT TO USE MICROSOFT OUTLOOK ON MY NEW COMPUTER. IS THERE ANY WAY I CAN GET MY INFORMATION OFF MY OLD ONE TO MY NEW ONE. I HAVE FOLDERS SET UP IN OUTLOOK EXPRESS WITH SEVERAL DIFFERENT EMAILS IN THERE. I DIDN'T KNOW IF THERE WAS A WAY TO GET ALL M INFORMATION TRANSFERRED TO MY NEW COMPUTER FROM MY OLD ONE. PLEASE HELP. THANKS BECKY You need to fix your more serious problem, the broken caps lock key, before we can help you with your question. "becky" <bsba@watchtv.net&g...

can't get my inbox to open
When I get to Outlook I can't get my inbox to open. the following message appears: C:\WINDOWS\Local Settings\Application Data\Microsoft\Outlook|Debbie S.pst. Quit all mailenabled applications, and use the Inbox Repair tool. When I try to use the repair tool it won't work Help! MY FRIEND TRY DETECT AND REPAIR OUTLOOK USE YOUR OFFICE CD .. AND TRY 2 SEE IF YOU CAN GET INTO INBOX OK.. GOODLUCK MICHAEL KHAN >-----Original Message----- >When I get to Outlook I can't get my inbox to open. the >following message appears: >C:\WINDOWS\Local Settings\Application >...