473,804 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get the selected Text from other Process

Hi folks,

I need to copy the selected text in any other application to the clipborad.

I played around with several ways which did not work:

Win API: Send a Message with WM_COPY --> Worked only with TextBoxes,
ComboBoxes and so on, There are several posts for doing so.
But way to copy from for example from IE.

Win API: Send some Messages wich should simulate pressing the Ctrl-C keys
(SendMessage and keybd_event)
Any Ideas ?

Regards,

Marcus
Nov 16 '05 #1
4 18710
Hi Marcus
check out this link

http://www.realvnc.com/pipermail/vnc...ry/005118.html

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
Hi Mohamed,

thanks for your help. But that was not what I was looking for.
I managed it by my self now.

My Question was to Send Ctrl-C to a window of any other process. This is to
tell
windows I wanna copy the selected text of the particular window. I need to
send Ctrl-C
cause the window may contains control other than Textbox or ComboBox (wich
accept the WM_COPY Message).

But as I told you I made it. If you need help doing the same let me now I
will tell you then.

Best regards,

Marcus


"Mohamoss" <mo************ @egdsc.microsof t.com> wrote in message
news:jw******** ******@cpmsftng xa06.phx.gbl...
Hi Marcus
check out this link

http://www.realvnc.com/pipermail/vnc...ry/005118.html

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #3
HI Marcus
thaks for the reply , yes sure please share that so any one would make use
of it while encountraing the same situation
thanks again
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #4
Hi Mohammed,

here is the code

....
[DllImport("User 32.dll")] private static extern bool

SetForegroundWi ndow(IntPtr hWnd);

[DllImport("user 32.dll", CharSet=CharSet .Auto)]

static public extern IntPtr GetForegroundWi ndow();

[DllImport("user 32.dll")]

static extern void keybd_event(byt e bVk, byte bScan, uint dwFlags,

uint dwExtraInfo);

.....

private void SendCtrlC(IntPt r hWnd)

{

uint KEYEVENTF_KEYUP = 2;

byte VK_CONTROL = 0x11;
SetForegroundWi ndow(hWnd);
keybd_event(VK_ CONTROL,0,0,0);

keybd_event (0x43, 0, 0, 0 ); //Send the C key (43 is "C")

keybd_event (0x43, 0, KEYEVENTF_KEYUP , 0);

keybd_event (VK_CONTROL, 0, KEYEVENTF_KEYUP , 0);// 'Left Control Up

}
Regards,

Marcus

"Mohamoss" <mo************ @egdsc.microsof t.com> wrote in message
news:eT******** ******@cpmsftng xa10.phx.gbl...
HI Marcus
thaks for the reply , yes sure please share that so any one would make use
of it while encountraing the same situation
thanks again
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6317
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
1
6333
by: DC Gringo | last post by:
I'm having such a problem with this DropDownList in a user control that is posting back and throwing an error: System.Web.HttpException: A DropDownList cannot have multiple items selected <ASP:DROPDOWNLIST ID="lbCountriesWiz" ENABLEVIEWSTATE="true" FONT-SIZE="8pt" ONSELECTEDINDEXCHANGED="ddlQueryProvinces" AUTOPOSTBACK="True" RUNAT="server" WIDTH="150px"></ASP:DROPDOWNLIST> Private Sub Page_Load(ByVal sender As System.Object, ByVal...
8
2297
by: rkrishna | last post by:
I have an issue that I am trying to solve. I have three select lists (supposed to be preference 1, 2,3) and each of them have the same three options. As soon as I select one of the choices from list1, i would like to remove it from the options of list 2 and so on for list 3. So effectively, List 2 has two choices and List3 only has one choice that can be made. Any pointers on how to accomplish this?
1
2389
by: sklett | last post by:
Hi- I apologize for asking this in the wrong forum, but I can't think what would be the correct one, OR... I can't find the correct one. Basically, I would like to execute a shell command on selected text. For example, after you install the google toolbar, you can search google based on the text that you have selected in a window. How is this done, anyone know?
9
56530
by: Steffen Laser | last post by:
Hi group, I have a problem that I already have posted to the german C# newsgroup. Since nobody could help me there, I'd like to try it here again: I set the selected item of a combobox like this: myCombo.SelectedItem = 3; But after that the ComboBox displays only the first entry of the list. When I add the line
1
3513
by: Aaron Prohaska | last post by:
I'm having the problem with this drop down list on postback. For some reason both the ListItems get selected when I change the selected item. Using the code below I'm building the drop down list in the overriden CreateChildControls method and setting the selected item. Then when I change the item in the drop down list the list is rebuilt from viewstate, but the initial item is still selected causing the error below. I also have a number...
4
2465
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
3
8720
by: imrantbd | last post by:
I need array type name like "destList" must use for my destlist select box,not a single name.Or need a solution to capture multiple value of "destList" select box and send all selected value in php page.The multiple select value then insert in database added by comma.The following is my code: Form Page:form.php <head> <script language="JavaScript"> function addSrcToDestList() { destList1 = window.document.forms.destList; srcList...
4
6144
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the extra item just doesn't get added to the DropDownList: ============================================= <script runat="server"> Sub Page_Load(..........) Dim dSet As DataSet Dim sqlConn As SqlConnection
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.