How to send key commands to another PC in .Net? - c#

I see a lot of examples where key strokes/commands are sent to other applications on the same PC, but I need to send key stroke commands to another PC. Is this possible? Through remote desktop or cleaner/easier way?
The goal here is that I press a key here, I need to execute that key (say it opens a program) on another PC without the need for a program installed on the client. Think about sending CTR + ALT + DEL on another PC.
Edit: we have Kinect plugged in to one of us PC's (which we intend to use as Server) and then we have many clients who will be receiving these key commands. Imagine I tell Kinect to open PowerPoint for me on some PC, since PowerPoint can be opened with a key command, I was hoping the easiest way would be to send those key commands from my Server. If this is not possible, then what are the alternative ways to do it? I am trying to avoid any application deployed on the clients, else I believe RDP could work then?

without the need for a program installed on the client
There has to be a server on the target PC to receive your commands. Since you exclude installing a program, this leaves us with the OS (I assume Windows), and afaik remote desktop.
The link below might help with this purpose (I haven't used it myself):
http://www.codeproject.com/Articles/43705/Remote-Desktop-using-C-NET

you must use a network comminication like a tcp or udp and you can use SendKeys. but there is no way to listen commands without running an application at remote pc.

Related

Is it possible to send a MessageBox over a network in C# - Without having any listening software on the receiving side?

So far, I've found plenty of ways to send and receive files over a network (mostly from this site), but I haven't been able to find a tutorial on how to do one with no listening software on the receiving side.
Example:
I want to send a messagebox with the title Hello, and the body There.
Normally, I would write out MessageBox.Show("Hello","There");
However, I want to be able to send the MessageBox over a network.
How would I do this, keeping in mind that:
Neither of the computers have admin privileges
I'm using windows 7 on both computers
The receiving side wouldn't have listening software on it.
Thanks in advance for anyone who helps me with this problem.
EDIT: It doesn't HAVE to be a MessageBox, I could make a forum that looks like one.
It's like saying, "Can I force you to do what I tell you, even if you're not listening to what I'm saying?"
To which the answer is, obviously, no.
If the other guy isn't plannig to respond to what you're saying, then, well, he won't.
You can't do this with a MessageBox, as that would be a pretty big loophole.
If you were using Windows XP, you might be able to use the "net send" command from the command line (hence callable in some way from a C# program, or from a batch file; whatever floats your boat), depending on the configuration of the machines.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_send.mspx
There was an equivalent program called msg.exe in Windows Vista, but it was removed altogether in Windows Seven.
-
In short, not with Windows Seven no.
You can shell out and call PsExec from Sysinternals to both copy and then run a program on a remote machine on your network - the program could be a listener you write or it could just be a program that displays a message it was given on the command line. PsExec isn't doing anything you couldn't do by calling the Windows API & using RPC directly, but that's a lot of work :)
Privileges will probably be an issue. At the end of the day there's no way for a non-admin user, out of the box, to muck with another machine on the network. You'll need permissions to be relaxed - maybe using group policy? But if you have group policy in place, just install a listener using an .msi or a login script.
Are you able to provide more information on WHY you want to do this? Perhaps there's a better way of achieving the notification you're after.
It is Possible with the msg.exe tool included in windows.
use the command
Shell("cmd.exe /c msg * /SERVER:" & ipAddress & " " & deineNachricht)
If your PC doesn't have msg, download it from somewhere.
Try looking into the code of this project- it used the net send command line program to send messages to remote machines, although i'm not sure how your mileage will go without admin privileges:
http://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&ved=0CCcQFjAA&url=http%3A%2F%2Fwww.codeproject.com%2FArticles%2F9466%2FThe-NetSend-Plus-NET-C&ei=hNOhT6ewH82RiQe--eCNCQ&usg=AFQjCNHzAjhU7SU7kuPSCQBLElR5vb1sIg

Bluetooth send/receive text without pairing using C# on 2 Windows 7 Computers

I have read that pairing is a must before communicating anything over bluetooth, but I want to know,
Can I create an application which would read a text which is
broadcasted by another bluetooth App without being paired.
Because we can see the names of other bluetooth devices around a device. So can't we set our bluetooth radio to a state that it would read any bluetooth boradcasting text message.
Example: there is createInsecureRfcommSocketToServiceRecord() & listenUsingInsecureRfcommWithServiceRecord() in android but aren't there such in C# for windows?
Thanks
My Ultimate Goal :-)
is creating an application running on windows 7 PCs, which create instant Bluetooth network for peer to peer file transfer and chat
Scenario
There is a group of people, each has this app on each computer, one wants to share a file, (may be an eBook, PDF or anything) with the rest. He sets his network "net" ( or any other name) in his app configuration and others also put that same name on each app. Finally each user can see the list of other Bluetooth nodes around them in their apps display, configured to same network name "net". so each can send files to selected nodes in the same network.
Design
Each user only turns on the Bluetooth radio and then enters a desired Network name in then app
Each application on PCs will communicate iteratively to reachable Bluetooth devices, through temporarily created connections (without pairing or user involvement), check their network names and list discoverable PCs with similar network names
Then they will share these lists among each other, so one PC knows the computers in their same network even though they are not in range directly.
Send files from one computer to one or many computers through a path resolved by an algorithm, even send chat texts.
All of this is going to be achieved through simple temporarily Bluetooth connections established between each application time to time, which requires no pairing or authentication, other than the Network Name. ( Because I don't know how to create Piconets using C#, or how to create bluetooth routing protocols.
No other security is implemented.
Please let me know of any other better design or way. Thank you very much for reading the lengthy text. Also include any helpful code which can help me achieve the above.
I make tens of un-paired connections every day... I don't know where this rumour comes from. :-,)
As you note on Android the default was for an authenticated connection -- maybe that's where the rumour started from? Even there, as you note, there are ways to request a 'pairing-not-required' connection e.g. listenUsingInsecureRfcommWithServiceRecord.
So, on the Microsoft stack on Windows one uses Bluetooth (RFCOMM) through a socket (winsock). By default that connection does not require authentication (pairing), nor encryption -- in fact to request auth/enc one must set a socket options. Similarly with Widcomm, you specify when you create the connection what security level you want, and that can be 'None'. Similarly on Bluetopia, similarly on BlueZ on Linux.
So if you use my library 32feet.NET, just use BluetoothClient and BluetoothListener and do not set cli.Authenticate=true etc. :-)
Some code examples
What's your ultimate goal? I've just realised that you were asking about file-transfer in another question... :-)
Anyway for transferring text... On the server-side have code like shown at: http://32feet.codeplex.com/wikipage?title=Bluetooth%20Server-side and on the client like: http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections Don't know if you know TextWriter/-Reader sublclasses on .NET, anyway on one side:
....
var wtr = new StreamWriter(peerStream);
wtr.WriteLine("hello");
wtr.Flush();
and on the other:
....
var wtr = new StreamReader(peerStream);
var line = wtr.ReadLine();
MessageBox.Show(line);
There's code in the BluetoothChat which pretty much does something like that.
Alan

Looking for any way to transfer file from PPC to PC

i looking for any way to transfer file from PPC to PC - and from PC to PPC ,
i dont want to use WebService, and if i use RAPI i need that in the PC will be any program - and i dont want
(i dont want that in the PC will be any of my program)
how i can do it ?
thank's in advance
You're going to need to be more specific -- the way the question is now it's basically impossible to determine what you're after.
Do you need to transfer a file from a Windows Mobile handheld to a Windows PC? Over what type of connection (are they on the same 802.11 network) ?
You need more details or no one will be able to even attempt to help you.
So, if what I gather is correct, you want to plug a device with your app on it into a PC and then be able to push files to the PC from the device without having to install anything over on the PC. Is that correct? If so, the next question is are you insane?
It's not possible, and for very good reason. You don't see any potential security problems with being able to just plug a device into a PC and push files up to the PC without the user having to explicitly have installed something to receive that data? I could write a simple attack app that would fill up the PC's hard drive in about 5 minutes.
A vanilla version of this is to just use the Active Sync synchronization folders. If you on the device save a file to the device synch folder, then Active Sync will move it over to the PC synch folder automatically.

Best way of executing code over the internet

basically, I am needing to execute a program on the viewers computer through a website. This program must be capable of talking to device drivers however, which makes it an unlikely candidate for activex. The website will only be used by clients(as in, it's not a public site) so having to change security settings isn't too big of a deal.
Also, we could possibly have them install an application on their computer, and then when they click a button on the website this activex control just executes the application they already installed to avoid device driver problems..
Does anyone have any ideas on how to do this well? I have a feeling activex won't just let you arbitrarily execute local applications. Also, it is preferred to be possible to do without certificates and signing(though it will eventually be over https)
(it's only tagged C# because that's the programming language to be used on both the client and server)
If you only need to tell the application to simply launch or launch with certain data, you can look into registering a protocol handler and create links, that the user can click, similar to myapp://the/data/you/need/to/send.
It sounds like you will have control over the client and server sides, so why not use WCF and set up the client application to connect to the server via a duplexed communication. On the server side keep a list of the clients that have connected to it and then when you need to trigger the client side code it will iterate over the list of clients and send the message to execute the code. And when the client disconnects it will be unregistered from the server.
See this link for more information on the duplex services.
Also, we could possibly have them install an application on their computer, and then when they click a button on the website this activex control just executes the application they already installed to avoid device driver problems..
Ding ding. That's pretty much what you'll have to do.

C# Automatic deployment/execution from a usb device

is there any way that a process on my usb will be launched automatically when the usb is connected to the computer?
Is there any way to deploy a file automatically from the usb, each time the usb is connected to the computer?
thanks.
The user would have to have "auto-play" enabled and then you can setup an autorun file to accomplish this, but it is highly dependent on the users configuration.
It should be noted that this is also a huge security concern for many people. Auto-run usb sticks are one of the ways that malware is automatically distributed.
Not trying to tell you your requirements, but I would consider if there is a better way to do this.
Take a look at Autorun.
I have an old mobile-phone that emulates a cd-drive with a autorun.inf on it. That autorun started an app that let me manage my mobile (calendar, callist, sms) from the computer.
This probably only works if the user has Autorun enabled. It's the first thing I disable.

Categories

Resources