Hi,
I need to make a little c# program which copies a text into the
clipboard and that pastes this data into the active window.
I copy the data like this
Clipboard.SetText("mystring");
but i don't know how to paste this data in the active window (notepad,
word for example)
thanks for your help (excuse my english, i am french) 9 4822
Clipboard.GetText
"Cédric ELLENA" <ce*******@hotmail.comwrote in message
news:11**********************@64g2000cwx.googlegro ups.com...
Hi,
I need to make a little c# program which copies a text into the
clipboard and that pastes this data into the active window.
I copy the data like this
Clipboard.SetText("mystring");
but i don't know how to paste this data in the active window (notepad,
word for example)
thanks for your help (excuse my english, i am french)
On 10 mar, 20:47, "VJ" <nonewsaddr...@yahoo.comwrote:
Clipboard.GetText
I know this, but I would like to affect the value of Clipboard.GetText
to the active object of my window. With visual basic it should be
something like this
Screen.ActiveControl = Clipboard.GetText()
I don't know the equivalent of this in C#.
I also have an other problem: when I launch my program, my windows
becomes inactive. how could i force it to stay active?
this.ActiveControl() where this is the Form. .
"Cédric ELLENA" <ce*******@hotmail.comwrote in message
news:11*********************@n33g2000cwc.googlegro ups.com...
On 10 mar, 20:47, "VJ" <nonewsaddr...@yahoo.comwrote:
>Clipboard.GetText
I know this, but I would like to affect the value of Clipboard.GetText
to the active object of my window. With visual basic it should be
something like this
Screen.ActiveControl = Clipboard.GetText()
I don't know the equivalent of this in C#.
I also have an other problem: when I launch my program, my windows
becomes inactive. how could i force it to stay active?
On 11 mar, 00:43, "VJ" <nonewsaddr...@yahoo.comwrote:
this.ActiveControl() where this is the Form.
Thanks a lot, but it still doesn't work. I do not use any form. I am
using a console application. My active window could be any
application : notepad, ie...
I have the error 'this' is not valid in a static property or method
with this
[STAThread]
static void Main()
{
Clipboard.SetText("00");
this.ActiveControl.Text = Clipboard.GetText();
}}
Should I use the GetForegroundWindow API function?
yes it will work for Windows only, my expertise is in Windows. If you want
for console, you can try to google or use the MSDN to see what options are
there. If I find time later today, I will research and post.
VJ
"Cédric ELLENA" <ce*******@hotmail.comwrote in message
news:11*********************@h3g2000cwc.googlegrou ps.com...
On 11 mar, 00:43, "VJ" <nonewsaddr...@yahoo.comwrote:
>this.ActiveControl() where this is the Form.
Thanks a lot, but it still doesn't work. I do not use any form. I am
using a console application. My active window could be any
application : notepad, ie...
I have the error 'this' is not valid in a static property or method
with this
[STAThread]
static void Main()
{
Clipboard.SetText("00");
this.ActiveControl.Text = Clipboard.GetText();
}}
Should I use the GetForegroundWindow API function?
On 11 mar, 02:54, "VJ" <nonewsaddr...@yahoo.comwrote:
yes it will work for Windows only, my expertise is in Windows. If you want
for console, you can try to google or use the MSDN to see what options are
there. If I find time later today, I will research and post.
Thanks, it will really help me.
I found this but for vb :'((
hWnd_Target = GetForegroundWindow
Calling_Pid = GetWindowThreadProcessId(hWnd_Target, 0)
AttachThreadInput App.ThreadID, GetWindowThreadProcessId(hWnd_Target,
0), True
SendMessage GetFocus, WM_PASTE, 0, ByVal 0&
AttachThreadInput App.ThreadID, GetWindowThreadProcessId(hWnd_Target,
0), False
Some people have posted links for vb to c-sharp conversion. You can just
Google convert VB to C-Sharp, you will find plenty that do it for free...
the below code is simple, its been 2 years I wrote any VB code, the below
looks simple enough for conversion. I don't want to attempt and give you a
bad conversion.
You are looking to automatically paste into active window, from your code?
Is that what you are trying?... interesting... never attempted something
like that. Not sure how that will happen across process.. Also as thought in
that line, assuming you are doing across process, you will fall into CAS i.e
Code access security, and if you are target Vista ( even some strict XP
environments) and above its pretty strict environment.. you have to make
sure your Console App has security clearance to do such... The below code
might be denied permission. I am not a expert in CAS or inter-process
communication. If that is what you are looking. Please post in
Microsoft.public.dotnet.security and get any doubts cleared.
VJ
"Cédric ELLENA" <ce*******@hotmail.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
On 11 mar, 02:54, "VJ" <nonewsaddr...@yahoo.comwrote:
>yes it will work for Windows only, my expertise is in Windows. If you want for console, you can try to google or use the MSDN to see what options are there. If I find time later today, I will research and post.
Thanks, it will really help me.
I found this but for vb :'((
hWnd_Target = GetForegroundWindow
Calling_Pid = GetWindowThreadProcessId(hWnd_Target, 0)
AttachThreadInput App.ThreadID, GetWindowThreadProcessId(hWnd_Target,
0), True
SendMessage GetFocus, WM_PASTE, 0, ByVal 0&
AttachThreadInput App.ThreadID, GetWindowThreadProcessId(hWnd_Target,
0), False
You are looking to automatically paste into active window, from your code?
Is that what you are trying?... interesting... never attempted something
like that. Not sure how that will happen across process..
Yes!!! It is exactly what i'm trying to do! Unfortunately, I have
vista, and as you said, i guess i will have some security problems..
If my code works, I will tell you if it runs under vista.
Ahh... the vista world.. Ok let me know, would like to learn always..
if you are developing on Vista, one inital good test would be run the
application as regular user ( non-admin ) and see what happens.
VJ
"Cédric ELLENA" <ce*******@hotmail.comwrote in message
news:11**********************@c51g2000cwc.googlegr oups.com...
>You are looking to automatically paste into active window, from your code? Is that what you are trying?... interesting... never attempted something like that. Not sure how that will happen across process..
Yes!!! It is exactly what i'm trying to do! Unfortunately, I have
vista, and as you said, i guess i will have some security problems..
If my code works, I will tell you if it runs under vista. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Arne Ballay |
last post by:
Hi,
I'm using JavaScript in a JSP where build up dynamik links (<a href...).
These links are shown on the current JSP page. We someone clicks the
Link another page changes (load the current URL)....
|
by: Dave Hammond |
last post by:
You'd think this would be a basic part of the window object (and
perhaps it is and I'm just being dense), but I can't find any reference
in the IE window object documentation to a property which...
|
by: anonymous_joe |
last post by:
I want to reload the current page in the current window.
I want to get a window reference to this.
something like
winRef=self.open(myURL); //where myURL is the current URL
but, that won't work...
|
by: Shang Wenbin |
last post by:
Hi,
Can I maximize the current window(not a popup window) when enter a
specified page in IE? It means no toolbar, no menubar, just like the
popup window opened with:
window.open("url","window...
|
by: Shang Wenbin |
last post by:
Hi,
When I want to close the current window using window.close() in IE6.0,
there will be a confirm box that: The web page you are viewing is trying
to close the window. Do you want to close this...
|
by: Roger Withnell |
last post by:
How do I recognise when the mouse pointer moves out of the current window?
Thanks in anticipation.
Posted Via Usenet.com Premium Usenet Newsgroup Services...
|
by: marc_donofrio |
last post by:
I can move and resize the current window.
I need a window that opens up with no Toolbars. I know how to achieve
this from another window via a link. But is there a method to reload
the current...
|
by: plumba |
last post by:
I have a form which I would like to open in a window with no address bar, tool bar etc etc. I've used the below code for this:
function delayer(){
newurl = "testpage.html"...
|
by: ismailc |
last post by:
Hi, I need help please!
I have a link on a page, where i wont it open in maximized window state.
the "_parent" allows to open in current window, but the maindow is never at maxmize state.
I...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |