|
I am using this code and trying to run the calc.exe
But calculator starts on my local system and not on that system also when i try to reboot the same system it does reboot.
Any help is appereciated
Dim co As ConnectionOptions = New ConnectionOptions
co.Username = UserID
co.Password = Password
Dim processClass As New ManagementClass("Win32_Process")
Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\IP\root\cimv2", co)
'Query remote computer across the connection
Dim oq As System.Management.ObjectQuery = New System.Management.ObjectQuery("SELECT * FROM Win32_Process")
Dim query1 As ManagementObjectSearcher = New ManagementObjectSearcher(ms, oq)
'Dim queryCollection1 As ManagementObjectCollection = query1.Get
Dim inParams As ManagementBaseObject = processClass.GetMethodParameters("Create")
' Fill in input parameter values
inParams("CommandLine") = "calc.exe"
Dim outParams As ManagementBaseObject = processClass.InvokeMethod("Create", inParams, Nothing)
|
|
|
|
|
Did you READ my post??
"You can use WMI, and it's Win32_Process class, to launch remote processes, but you cannot launch interactive processes remotely. That means anything with a user interface."
This means that you can launch Calc on the remote machine, but the user on that machine CANNOT use it, since no user interface is displayed!
There is NO way around this!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
But there is no calc process running on the remote system. Process only runs on the local machine
|
|
|
|
|
:SMACK: Listen to what I'm saying!!!!!!!!!!!!!
The process starts on the remote system, BUT THERE WILL NOT BE ANY VISIBLE USER INTERFACE ON THAT MACHINE!! If the application you launch tolerates this, it will stay running and show up in the TaskManager on the remote machine. If not, it'll quit immediately.
But, in either case, the user on that machine will NEVER see the user interface of a process on his machine that was launched from another computer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I understand and this is what i want to communicate, there is no process running on the remote machine in the task manager.
I m not bothered abt the interface calc.exe is just and example
The process starts on the local machine in the task manager.
|
|
|
|
|
When you created the Win32_Process class, you didn't give the ManagementClass the scope you wanted to create the class in, so the default scope is used -> the local machine.
Dim co As New ConnectionOptions
With co
.Impersonation = System.Management.ImpersonationLevel.Impersonate
.Authentication = System.Management.AuthenticationLevel.Packet
.Username = "Admin level account on target machine"
.Password = "password"
End With
Dim scope As ManagementScope
Dim machine As String = "targetMachineName"
scope = New ManagementScope("\\" & machine& "\root\cimv2", co)
scope.Connect()
If scope.IsConnected = False Then
MsgBox("Could not connect to WMI namespace")
End If
Dim proc As New ManagementClass(scope, New ManagementPath("Win32_Process"), Nothing)
Dim inParams As ManagementBaseObject = proc.GetMethodParameters("Create")
inParams("CommandLine") = "calc.exe"
Dim outParams As ManagementBaseObject = proc.InvokeMethod("Create", inParams, Nothing)
Debug.WriteLine("Win32_Process:Create returned: " & outParams("returnValue").ToString())
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
My VB.NET application launches an Internet Explorer session, which in turn launches a Java Application. I need to be able to control the Java application window (i.e., Minimize, Restore, Activate).
I can control the IE window (Because I launched it), but can't control the Java application window.
I have tried using the findWindow and ShowWindow win32 api's, with no joy.
Any ideas??
|
|
|
|
|
There is really nothing you can do to control a Java app. Everything you see is not rendered using Win32-based components, so using Win32 based methods to find their windows won't work.
The best you have is using SendKeys to send keystrokes to the window, but this is problematic at best. Being a shared system, the input focus can change at any time, sending your keystrokes to something you didn't intend. Also, you won't be able to read anything out of the Java window.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That's what I figured... Thanks for the response...
|
|
|
|
|
Does this mean SendKeys Cntl-C won't work to copy the values out of the application? I am trying to implement this (using sendkeys), but I am not having any luck. For some reason the copy doesn't work nor do Shift-End or Shift-Home. Do you know the reason why?
Can you use a Java app to read from another Java app or is this just not possible all together?
Thanks.
Mike Lasseter
|
|
|
|
|
mr_lasseter wrote: Does this mean SendKeys Cntl-C won't work to copy the values out of the application? I am trying to implement this (using sendkeys), but I am not having any luck. For some reason the copy doesn't work nor do Shift-End or Shift-Home. Do you know the reason why?
It won't work with a Java app because NOTHING in a Java client window is based in Win32. It's all entirely custom drawn by the Java Runtime. Ctrl-C works because it's coded into the standard TextBox controls used by any of the Win32 libraries, even in the .NET world. Since Java's stuff doesn't rely on Win32 at all, you don't get the benefits of the standard functions built into those controls.
The only way it'll work is if the Java control you're app is using exposes an interface/functions that understands that Ctrl-C mean "copy the contents to the Windows clipboard". Since Java is platform independant, this doesn't happen, since not ever platform supports a clipboard.
mr_lasseter wrote: Can you use a Java app to read from another Java app or is this just not possible all together?
No, you can't, unless the applications involved expose and use some kind of Remoting facility. There's no way to send keystrokes or read the Text property of a Java control from any other application, Java-based or otherwise.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello!
i change a pe file and i encode code and data sections of this file.
now new pe file, first decodes two sections then it runs.
but there is an error for exe files that they are created by VB :
"The application failed to initialize properly (0xc00000005)"
Zo.Naderi-Iran
|
|
|
|
|
What on earth are you doing that requires this?
And created by what version of VB?? VB6, VB.NET??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
because i want protect my pe file, then i encode code and data sections of pe file.
for exe file that it is created by VC6, i have not any problem, and protected exe run correctly.
but for exe file that it is created by VB6, there is this error.
Zo.Naderi-Iran
|
|
|
|
|
There's nothing really that special about a VB6 .EXE. Other than the large number of imports from the Runtime library. It's probably organized a bit differently from a C/C++ app though. You may want to use PEDump or PEBrowse to get the layout. If you're adding or removing data from the file, you could be changing offsets into the .EXE, invalidating them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,everybody!
Very happy you could read my Question.Thank you very much if you could give some suggestion.
Connectting mass points one by one forms an undee chart.
I want to redraw the undee chart next time.
Must i stroe these point data to database?
If i do so,i should read out these mass data from database when i want to redraw the undee chart.
I do think it is an assheaded idea.
ICQ:258-235-734
MSN:msnadair@hotmail.com
|
|
|
|
|
I have no idea what you're using to draw this chart, but yes, if you want the chart redrawn, you have to have the data available somewhere, whether it is stored in the control that's doing the rendering, or in a database that the control knows how to get to. But this depends entirely on the requirements of the control.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
What type data?
X-Y plot type
A time series in real-time (like stock quote)
Sampling data on a 2D domain regular or irregular (like elevation on the earth)
Best,
Jun
|
|
|
|
|
IF i running my application and i 1 2 run it one more i don't want run just only one that can be run in one time
................
|
|
|
|
|
Socheat.Net wrote: IF i running my application and i 1 2 run it one more i don't want run just only one that can be run in one time
What do you mean? I don't understand your question.
|
|
|
|
|
Example Like Yahoo Messenger You can run it 1 while u r using it
................
|
|
|
|
|
This is a forum, not an SMS service. If you try to write complete sentences without "lazy" abbreviations, it might be possible to understand what you are trying to say.
---
b { font-weight: normal; }
|
|
|
|
|
One time i want to run the same application only one, like Yahoo Messenger
................
-- modified at 5:48 Wednesday 5th July, 2006
|
|
|
|
|
Are you trying to say that you just want to run an instance of your application and avoid running more instances at the same time?
that's a problem of the SMS language ... that's my interpretation of what he's said.
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Socheat, I'm sorry that I still can't figure out about what you mean. Can you give another example of the name of the other application? Tell me about the way that you want to do and the way that you don't want to do.
I know about yahoo messenger but I don't understand about application behavior that you want to do in your application.
|
|
|
|