473,394 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 18647
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.microsoft.com> wrote in message
news:jw**************@cpmsftngxa06.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("User32.dll")] private static extern bool

SetForegroundWindow(IntPtr hWnd);

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

static public extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]

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

uint dwExtraInfo);

.....

private void SendCtrlC(IntPtr hWnd)

{

uint KEYEVENTF_KEYUP = 2;

byte VK_CONTROL = 0x11;
SetForegroundWindow(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.microsoft.com> wrote in message
news:eT**************@cpmsftngxa10.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
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...
1
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 ...
8
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...
1
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...
9
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...
1
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...
4
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,...
3
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.