|
Uh, basically your going to need...
1. A server app for the remote computer
2. A client app for you
And that's it.
The server will sit on the remote computer listening for for requests on the specified port. This is done with the TcpListener.[^]
Then client app will be on your compter and will use the TcpClient class[^] and take the ip address of the server app and the port in the Connect method.
It's pretty simple. Uh, I think the best way is to look at examples here and on msdn. And, also for the server functions like logging off you can use the API ExitWindowsEx[^]. Uh.... and there are .net classes like Process for killing apps and stuff...
yeah.... SO here's the overview. Make the server and the client. Start the server on the remote machine and start it listening for incoming connections. then start your client then say... You have some preconfigurations in your server code that says if the incoming message says "logoff" then your server will run the ExitWindowsEx method. So, with your client enter the name/ip of your remote computer and then send "logoff" to the server then your remote comp. will logoff. there. done.
I hope my links work. Remember, theres lots or examples here and msdn.
/\ |_ E X E GG
|
|
|
|
|
thanks that help me alot
ADEL K Khalil
|
|
|
|
|
RealVNC.COM (free, easy, works).
|
|
|
|
|
This easiest way is to use the WSH and vbscript. Here is a quick sample
<br />
'strCompName = "." 'This is for the local host<br />
strCompName = "computer name" ' ip address may work as well<br />
Set objWMIService = GetObject("winmgmts:" _<br />
& "{impersonationLevel=impersonate}!\\" & strCompName & "\root\cimv2")<br />
Set colProcessList = objWMIService.ExecQuery _<br />
("Select * from Win32_Process Where Name = 'Notepad.exe'")<br />
For Each objProcess in colProcessList<br />
objProcess.Terminate()<br />
Next<br />
Save the code above as stopnotepad.vbs and call it from the commandline with cscript stopnotepad.vbs
You may want to check out the MSDN section on scripting, particullarly the scripting clinic and scripting guys.
|
|
|
|
|
Well, code project is great for my .NET resources.
I'm looking for a forum just as great as this, but for Java programming.
Any recommendation?
Thanks
|
|
|
|
|
http://forum.java.sun.com/
is pretty responsive, but people there seem to be a little more uptight and they tend to poke at you if you ask simple questions.
|
|
|
|
|
I use a TextBox to edit data in ListView(From a MSDN Article),but the TextBox height biger than listview ,that looks very urgly,how to make the height of ListView row equals with height of TextBox ?
|
|
|
|
|
If you use imagelist for your ListView, then you can force higher line height by having your images as large as needed.
It's a stupid workaround, but it works for me.
|
|
|
|
|
I'm trying to print a report created with Report Services, but I don't understand how it is devided into pages (ex 1/3) and how I can print all the pages, not only what fits into the first print page! it is possible to resize some how what I need to print?
//Report printing code
SHDocVw.OLECMDEXECOPT doOpt;
object o = new object();
doOpt = SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER;
axWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT , doOpt, ref o, ref o);
Thanks!!!
|
|
|
|
|
You're not making any sense. Using the IOleCommandTarget implementation - as you're doing - invokes the printing functionality in Internet Exporer, which - last time I checked - prints all pages unless the user specifies a range. Since you're specifying OLECMDEXECOPT_PROMPTUSER , they should be seeing this dialog.
So what exactly are you trying to do?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am making an app where you can click on an image (in a picturebox) to get X, Y, Width, and Height values. I would like to make it draw a rectangle of the specifyed X Y Width Height values on the PictureBox/Form once selected. Is this possible?
Help is much appreciated,
~ZeldaFreak
|
|
|
|
|
You could always add code in the OnPaint event. If you just want to draw a single rectangle just declare a rectangle on the form object, then using mouse events once it is selected set the Selection Rectangle object to the appropriate values and then call this.Invalidate(); It will force a repaint of the object. Inside the paint routine you can have code to only bother drawing the rectangle if a selection has been made.
The actual drawing of the rectangle can be done via the System.Windows.Forms.PaintEventArgs object which is passed to the routine. Simply use the e.Graphics.DrawRectangle(); method to draw the actual rectangle. An example of this called would be:
e.Graphics.DrawRectangle(new Pen(Color.Red, 1), x, y, mySelection.Width, mySelection.Height);
I am sure there is a better way out there but this should work.
|
|
|
|
|
Hi,
short question. What control can I use to display html pages in my winforms app. Just a starting point needed.
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
In the toolbox, right click and select the function for adding new controls.
In the selector window, click on the COM tab.
Scroll to bottom and choose Web Browser.
Drag and drop that to your form or container control.
You may also want to look at the articles on other fun things you can do with that control. (NOTE: I use the word fun with tongue in cheek)
In the main menu get into the C# menu for articles.
Choose the COM Interop selection.
Nick and I have two good articles to read. You are quite likely to need either process or both at some point in time.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Hi,
thanks for your reply. Since I'm not using Visual Studio, I can't simply follow your steps. So I thought, good thing would be to use the tool tlbimp.exe (SDK) to get an assembly from the mshtml.dll typelib, located in the Winnt\System32 folder. But tlbimp keeps telling me, that it is not a valid typelib.
Can you tell me how I can create the appropriate assemblies using tlbimp or aximp so that I can use them eventhough I don't have Visual Studio installed?
Thanks in advance!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
I think you should be able to, but you will have a very hard time constructing this without VS!!!
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
HI!
I am currently at the beginning of a new project and I would like to start
with something out of the box. As we started our Web project we used IBuySpy Portal
and it worked fine because we did not waste our time on authentification,
authorisation and all that but we were able to start right with the logic
of the application. Is there something like that for SmartClient? I mean template
solution containing the newest application blocks of Microsoft?
Any comments or help will be highly appreciated.
gicio
|
|
|
|
|
As I understand it, the Application Blocks are basically large 'patterns' for deployment. So if you find an Application Block that provides the SmartClient pattern, then that is where you would begin.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
I did a windows usercontrol,then I put it in my web appliation.Others client run this web application to http.But, a thing was happened,because I use a localhost's filepath, but,there was not on others client.So,at run time, error was happened. I wanted to know, if web application had windows usercontrol then run my web application on others client, which resource was be used windows usercontrol.
|
|
|
|
|
Your question doesn't make ANY sense whatsoever.
jzb wrote:
I did a windows usercontrol
You created a Windows Forms User Control? Or did you create a Web User Control?
jzb wrote:
because I use a localhost's filepath, but,there was not on others client.
Localhost's FilePath for what? You should NOT be using client FilePaths for anything since, inside a web browser, access to the clients FileSystem is forbidden for security reasons.
jzb wrote:
which resource was be used windows usercontrol.
What? Are you asking what resources a control has access to on the client side? The FileSystem on the client machine is NOT accessible from within a web browser.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Actually, you can embed a Windows Forms UserControl in a web page and it can access the file system (by default in .NET 1.1, using isolated storage), so long as you have the permissions to do so.
See my old article at http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388[^].
I think he's having problems access a file on the web server from the UserControl which is executed client-side, but I can't really make any sense of his question either.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I can't really make sense of your question either, but let me try...
You're saying that the UserControl you've embedded in a web page uses http://localhost to access a file on the server? IF so, ALL content in a browser window that users see - including embedded .NET, ActiveX, and Java controls - run all on the client machine. So http://localhost refers to their machine, which requires that a web server be running. While "localhost" resolves to the 127.0.0.1 IP address that all machines define as themselves (the loopback address), putting http:// requires that they have an HTTP daemon (like IIS or Apache) running on the default HTTP port, which is port 80. Fat chance that all your clients have that.
So, remember that your embedded user control runs client-side. The only access back to the server is the same as any user would have to make: you need to use the fully-qualified URL of the server. Any file paths you use must also be local to their machine.
Above all, you must grant your user control permissions by getting the users to install a code group on their machines. If they don't, your options are none to limited so program accordingly. In .NET 1.0, controls in the Internet zone were not allowed to execute at all. In .NET 1.1 (partly thanks to yours truly), controls in the Internet zone are granted some permissions, but not many. The only file system access is through isolated storage (System.IO.IsolatedStorage ). So you have to add a code group (do not change the Internet_Zone group!) that grants your assembly/assemblies the necessary permissions based on host or strong name identity evidence (other types of evidence are not collected by IEExec.exe, the managed host for Internet Explorer).
Read my old article, User Controls for Windows and the Web[^], for more details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
I have a problem with menu and FormBorderStyle = None:
I opened new C# project and set the property FormBorderStyle = None , And added main menu. When I run the application and on the last pixel of the menu, i have got a line drawn. This line divide the menu and the rest of the form. How can I make the line disappear?
Thanks Rafi
|
|
|
|
|
Can we define constructor with arguments in web service.
So, suppose the Web service.asmx file looks like:
public class Service2 : System.Web.Services.WebService
{
string b = null;
public Service2()
{
InitializeComponent();
}
public Service2(string b1)
{
b = b1;
}
[WebMethod]
public string HelloWorld(string vivs)
{
return vivs+ b;
}
and at client side, I am creating proxy object like:
WebService1.localhost.Service2 obj = new WebService1.localhost.Service2("Hello");
string myname = obj.HelloWorld("vivekagarwal");
Response.Write(myname);
But the problem is, i am getting error while creating object with passing argument ("Hello").
It is saying that we can't pass the argument.(Even when I have created the default constructor with no-argument)
any body has any idea???..becaz my primary function here is..to initialize the object upon creation...
Thanks
-Vivek Agarwal
|
|
|
|
|
Sure you can define such a constructor, but it won't make a difference. The XML Web Service specifications don't describe activation but remote method calls. ASP.NET - having to instantiate the WebService derivative when calls are made - has to instantiate objects because that's how the .NET Framework works. XML-RPC - a predacessor to XML Web Services and there are now WSDL/SOAP-compliant libraries - simply allows you to call methods with an object at all. For that matter, so does XML Web Services.
Object activation is a feature of the hosting framework - not of XML Web Services.
Even when you instantiate your client proxy for the XML Web Service, the object on the server is not created. It is created on the first call to its methods with a particular lifetime. It's when you make calls that any remote calls are made.
In fact, find yourself a packet analyzer (like the widely popular WinPcap with its corresponding Analyer program) and examine the packets after 1) instantiating the client proxy, and 2) calling a method. You'll actually only see one request (assuming data chunking isn't used for that method): for the method.
Microsoft MVP, Visual C#
My Articles
|
|
|
|