hi all,
I am completely stumped out but I did not find the solution of my query so far. so I am in hope posting this here in this forum.
My query is: I have an application runs on my desktop. I want to take data from the desktop application by using right click of the mouse and copy and paste in the note pad.Then I got the data in text format. But I am fed up doing so again and again the same proceedure. Is there any method to copy the data without using the desktop application to text automatically. I just need that by clicking the button to get the data in text format. Please note that the data is changing continously on the desktop. Any one can help me on this account.
Thanks for good anticipation.

Recommended Answers

All 3 Replies

Okay, if I understand you right. The program of yours is the source of the text that is pasted into notepad. If this is true, then there are several ways in which to solve this.

First, you could write the text directly to a text file by using the following...

FreeFile Function
Open Statement
Print Statement
Close Statement

(Look up in VB's help if you need more help)

Now, if you are wanting to post this data directly into notepad, without writing a file to disk... Well this is going to be harder to do. You will need to know and use a fair amount of API...

FindWindow 'finds the parent window
EnumChildWindow 'find the "text area" of notepad
SendMessage with WM_SETTEXT const 'puts the text into the running notepad application

Now, if on the other hand, the data is coming from notepad and you want to import it into your program well then...

FreeFile Function
Open Statment
Input Function or Line Input Function
Close Statement

Or if you want to copy directly from notepad... (API once again)

FindWindow
EnumChildWindow
SendMessage with the WM_GETTEXT const.

Good Luck

Thanks for the quick reply. Since I am the beginer and it is very hard to understand for me to function like enum parent window and child window.I request you to kindly give me the example or demo of such program. But I want to get data from the running application on the desktop and not from the notepad. and I want to copy that data in the text format on my programe in text box for reviewing and saving.

Well if it is your program, then make it write out a text file, and use shell or the shellexecute API to launch notepad with the file you have created. Now if this program is not yours, well it is time to use your friends (yahoo, google, ask, answers, bing) to search for vb6 and the API you want to learn about, like, vb6 findwindow, or vb6 enumchildwindows.

I suggest this because there is so much code out there for visual basic 6 and .net that it is not funny. Also, other places to check for code examples can be found in the first or second pinned thread of this forum.

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.