|
Are you sure this is the URL you're using?? It works fine for me.
Wait a minute... What version of Visual Studio are you using?? An Express Edition??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
Is there a way to make a certain application as the active window at certain instance? For example, I want to make another application(such as print etc) as the active window while my application(vb project) is running. Also, is there a way to return the focus to my application for example by a click of certain keystrokes or button? I'm not sure what it is called, but its like controlling the input focus so that it belongs to different application at different instance. I hope you understand what I mean.
|
|
|
|
|
Kind of. I know where you're going with this ... SendKeys.
You can change the active application using VB6's AppActive function. All you need to do is give it the window title that it needs to find. The problem is, you can guarantee it's going to stay there between the time you call AppActivate and SendKeys get's done sending its information.
Once your done, to get the focus back to your own app, all you do is call SetFocus on the control on your form that you want the focus sent to.
Focus can change at any time, even while you, or SendKeys, is typing in a control. It's maddening when a background service just insists on popping up a warning dialog, or someone has a IM window open, like Yahoo Messenger, and a message comes in, stealing the focus from yours or any other application!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have to make software which i scan the picture and print imidiatly from VB.NET. how i make that software plz reply me.
Muhammad SYed
muhsyed@gmail.com
|
|
|
|
|
You might want to ask specific questions about what you're having a problem with. Just asking "How can write this entire piece of software" will just get you ignored.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
I have an exe which is placed on server and i am executing it from a network system
now to execute the exe i am using the process class
The problem is that when i execute the exe it executes on the local system and not on the server.
I checked the processes in the task manager and it is showing that the exe process is running on the local system wherease i want to execute the exe on the server.
How can i invoke the exe from a network system and run on server
|
|
|
|
|
There are HUGE security implications when doing this. 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. Also, the process you launch will be severly restricted in what it can do and what it can get to, depending on the account that it is launched under.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
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
|
|
|
|