Associate Process With Current Process
Dec 21, 2010
I have a winforms application that calls an command line program. My application is MyApp.exe for example, and the application I call is OtherApp. exe - if my user exits my application properly, I can "kill" the instance of OtherApp.exe - however if the user uses task manager to kill MyApp.exe, I cannot kill OtherApp.exe... when I load the OtherApp.exe, is there a way to associate it with MyApp.exe so MyApp.exe can kill both automatically? I only allow MyApp.exe to load one OtherApp.exe at a time, and it is stored in a global variable.Basically even if OtherApp.exe is currently running (inside procJob), I want the procJob (and associated OtherApp.exe) to be killed if MyApp.exe exits by force in task manager.[code]
View 9 Replies
ADVERTISEMENT
Sep 27, 2010
How to get full path of current directory of process from where process starts Like if i use my software to start somefile then I want my software to know where she started it from ( files path) What I mean is the file I opend using my softwares location.
View 2 Replies
Apr 29, 2011
VB.net 2010 Read all around the net, but cannot seem to do this: Tried the performance counter Categoryname=process Instancename=("program"). _Total helps in part- but it would be more efficient to acquire the main applications cpu usage for this project.
Code:for each p as process in process.getprocesses if p.id=process.getcurrentprocess.id then end if next 'Values, Obviously multiple processor cores have to be taken into account'kernelmodetime, usermodetime, Cputime, total cpu time, 100% <-- Does this involve adding and or dividing all these times? I need the current process CPU usage.
View 4 Replies
Jun 4, 2009
I have written a windows service that is meant to launch a notepad when a specific action happens. The problem i have is that even though the service launches notepad, the actual notepad it self is NOT visible. I know that it has been launced because i can see the process in the task manager. By the way the process is listed as a SYSTEM process rather than a process under my user name (i believe that is because my process is a "LocalSystem" one).
View 4 Replies
May 13, 2009
I want to get the current directory of any process. As I have seen in Process Explorer tool that it is possible, but don't know how??
View 7 Replies
Sep 22, 2010
I have this in a VB.NET console application:
Dim p As ProcessStartInfo
p = New ProcessStartInfo(Environment.CurrentDirectory & "injavac.exe",ClassName & ".java")
Dim ps As Process = Process.Start(p)
This does run the java compiler on the file, but it does so in a new window. I want the output from javac to appear in the same console that is running my application. How can I do this? Perhaps there is another method for running commands in the current console? Or maybe I can supress the second console window from opening and redirect its output to the current console?
View 2 Replies
Jun 7, 2010
Is there a way to get my own process' memory range? For example, I want to read all memory of my own process:
[Code]...
But I always get an AccessViolationException, because, of course, I'm using IntPtr.Zero instread of my own address and 1000 instead of my own memory size. Is there a way to get these?
View 26 Replies
Mar 23, 2012
I want my vb.net dll to get the data sent from c++ project(exe).Can any body help on in what form this void pointer can be sent via pipe. The void pointer corresponds to enums or structures. I have to get this structures/enums on the vb.net dll end. I have mentioned about using pipe. My question is as what type the pointed to data can be send over the pipe so that I can easily handle the received data at the vb.net dll end.
View 1 Replies
Oct 13, 2009
i am trying to write a little program that checks for a process and kills is.here is the
Dim p As Process = Process.GetProcessesByName("Cheat Engine")(0)
p.CloseMainWindow()[code]...
My problem is it�s woking ,yes if the programm ,,Cheat Engine" is running the process is getting killed.But if the program is not running my program crashes.
View 5 Replies
Sep 9, 2011
I'm executing a remote process using WMI and would like to redirect the StandardOutput of that process back to my program. I have found these code examples:
[Code]...
View 1 Replies
Sep 1, 2009
I am getting an error with this code.
The process cannot access the file 'C:UsersdavidDesktopTest Folderdavid 2.xml' because it is being used by another process.
how do i end the prosess after I create the file? Or am I creating it in the wrong manner.The underlined line is where the error ocures.
Public Sub AddDTData(ByVal value1 As String, ByVal value2 As String, ByVal filename As String)
dtUser.Rows.Add(value1, value2, Now.Date)
If My.Computer.FileSystem.FileExists(filename) Then
[code]....
View 4 Replies
Sep 28, 2010
My app starts an On-Screen Keyboard process like this:
Dim PID as System.Diagnostics.Process
:
PID = Process.Start("C:WindowsSystem32osk.exe")
:
[CODE]...
It seems to work 90% of the time. However, sometimes the PID.Kill() fails because it says the process already exited. At this point the OSK is always still there on screen. Yes, I know my code should be testing to see if the process is still running before trying to kill it, but given that the OSK is still on screen..
View 10 Replies
Feb 21, 2011
I have a program that starts another program after setting the regkeys basically the program continually syncs the calandar of outlook and another application.I set the regkeys than launch the c:sync.exe app. I have tried a simple process.start and launching the process as a thread and they both do the same thing: The other process starts and works as it should but my main program goes "White screen" or "not responding" until the process.start has exited.
I want the process.start to run in the background so if users click in my main app it responds and truly that they can access the context menu of my main app from the taskbar while the process.start is running.
View 5 Replies
Apr 24, 2011
i want a code that if a process that i picked is no match in a process list that process that i picked will start
View 4 Replies
May 27, 2010
Trying to create a button that when clicked will check to see if a certain process image is running and if that process is running give the process focus. If the process is not running then start the application.
View 9 Replies
Nov 19, 2011
I am working on a small VB application that listens for commands sent from an Android app.
One of the functions is to extract an archive. I am familiar with how to listen for the unrar process to finish, so I can display a progressdialog on the phone while the extraction is happening, and clear it as soon as it's done.
BUT ... if there is an error/alert from WinRAR, WaitForExit() never gets called because WinRAR is still sitting there open until I click "OK" on the MsgBox.
For Example ... if you try to extract a file that is not actually an archive... an alert will pop up saying "No Archives Found", and basically everything is halted on the VB app and the Android app, and the Android app just sits on a progressdialog saying "extracting..." until you manually hit "OK" on the computer.
As you can imagine, this is a problem if the whole point of your app is to NOT have to go over to the computer.
So... I am wondering if there is something similar to WaitForExit() that will wait for an error and allow me to close out the alert and let the process end.
Here's my Sub for the UnRar command:
Private Sub UnRar(ByVal WorkingDirectory As String, ByVal filepath As String)
Dim objRegKey As RegistryKey
objRegKey = Registry.ClassesRoot.OpenSubKey("WinRARShellOpenCommand")
[Code]......
View 9 Replies
Feb 10, 2009
I have an issue using Process.MainWindowTitle,Process.MainWindowHandle on some older VB6 applications. After Process.Start I use Process.MainWindowTitle to display in a listbox. The MainWindowTitle returned is not the Window Title but in fact the Project name of the VB6 exe.? I also store the MainWindowHandle to use the ShowWindow and SetForeGroundWindow API's. It would appear that the ShowWindow API does not work, but the SetForegroundWindow does. ie: if the VB6 app is minimized, showwindow does not restore, if it is NOT minimized setforewgroundwindow sets it to the foreground. The exact same code does work correctly for any other .net exe or notepad, only on these vb6 programs I am having a problem.
View 9 Replies
Sep 13, 2011
I try to open a text file and write in some text, when i run the program it says the following error:The process cannot access the file 'D:VB projectsCategory_Characteristics.txt' because it is being used by another process.
THe code is as follows and the error hits in line :
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
-----------------------------------------
Dim FILE_NAME As String = "D:VB projectsCategory_Characteristics.txt"
[code]....
View 5 Replies
Feb 27, 2012
I was wondering if this code could be better optimized for multithreading. What it does is open a process and loops through the data, there could be any range of files to open (so I would like to have say 2 or 3 processes at once):
[Code]...
View 19 Replies
Feb 13, 2012
I have a procedure (parent process) that starts several processes (child processes). The child processes calculate several array variables. How can I pass those arrays to the parent process? At the moment, the child processes write the arrays to a streambuilder and the parent process reads the stream. Is there a better way to do it? Is it possible to have the child processes write to RAM memory and have the parent process read from there? It is like declaring a global variable in the parent process and give the child processes access to it.
View 4 Replies
Aug 31, 2009
How can i access a file through FileStream which is being used by a window service. Actually i am trying to access a file which is also being used by our window service. I need to read data from this file. I am using below code but also getting following error:
Code:
Dim fs1 As IO.FileStream = New IO.FileStream(psPath, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim sr As IO.StreamReader = New IO.StreamReader(fs1)
sData = sr.ReadToEnd
Error: The process cannot access the file 'FILENAME' because it is being used by another process.
I tried changing FileShare.Read parameter to FileShare.None but it didn't work out. I also read below post which says that it is not possible but i think there is a way to read it like if you open a file through Firefox but still window service is accessing it.
View 2 Replies
Aug 8, 2010
Whats happening is I run the code below and get the following error "The system cannot find the file specified". I've read that with UseShellExecute set to false that you can't use WorkingDirectory.
Dim Password As String = "password"
Dim SecureStringPassword As New System.Security.SecureString
For Each c As Char In Password
[Code].....
View 8 Replies
Oct 27, 2011
I am working with saving and deleting images. What i really want to do is check and see if an image exists in the destination folder and if it does automatically overwrite it. i couldnt figure that out so i figured i would look to see if the file was there if it is Delete it then write the new file..The issue is i keep getting this error.The process cannot access the file "FileName" because it is being used by another process. [code]
View 5 Replies
Dec 8, 2011
How would I go about starting a new process without it being the child of the calling process.
Example:
Main Program (Caller.exe)
process.start("file.exe")
View 3 Replies
Dec 4, 2011
The process cannot access the file 'C:UsersJoshuaDocumentsTest1.txt' because it is being used by another process.Now the Problem. When i step through my code, it will do as intended, e.g. clear all contents of test1.txt. when i run it at run time it throws this error. The reason for it throwing an error is the text file is reading string, int, string, and the txt file has a string including in the int part, so i'm making it so you can empty a corrupt file.
vb
Imports System.IO
Public Class Form1
Private norepeat As Boolean
[code]....
View 3 Replies
Jun 24, 2009
i use System.Diagnostics.Process.Start to run a process
example :
Dim p As New System.Diagnostics.Process
p = System.Diagnostics.Process.Start("D:ProjectApplication.exe")
it works perfectly during run time. but after i deploy to server.... this code did nothing, it did not call out this process
View 1 Replies
May 2, 2011
I have a 32 bit application that shells a second application that can be 32 or 64-bit depending upon the computer it's running on. I only want one instance of the second application to run at a time, and I need the first application to prevent the second from being launched more than once. I want to be able to use GetProcessesByName to obtain the running processes. This seems to work fine. It's when I attempt to obtain the module data to find out what folder the second application was run from that things fall apart.
[Code]...
View 2 Replies
Mar 2, 2011
I am almost sure this isn't possible but it's worth an ask... We have a .NET DLL that is being called from our VB6 application. The VB6 app runs in a 32 bit process so the DLL runs in the same process (it's compiled as any cpu) Therefore when I do my ODBC Database access in the DLL is will only use a 32 bit driver, as this is what it thinks it needs (for the record the DB is Pervasive PSQL)
My problem arises when the application runs on a 64 bit machine (when only the 64 bit ODBC driver is installed) as it can't find a suitable driver to use. So is there a way to force the .NET DLL to run in a 64 bit process (compiling as x64 doesn't work because register for COM Interop is not allowed) This isn't necessarily an issue at this point in time because I can install the 32 bit driver, but at some point in the future I can imagine that 32 bit driver may not be available so I will be up the proverbial creek.
View 1 Replies
Mar 12, 2010
I'm using VB.NET for a web-application that starts some process using CreateObject, like this:
Dim AVObject = CreateObject("avwin.application")
After all is done everything get closed down en stopped using the proper release functions, however, for some reason the process remains.
Is there some way in which I can get the process id of the started process, in order to explicitly kill it just before termination?
View 2 Replies
Jun 19, 2012
i want to insert all processes that running into listbox, and also how to "kill" process and start process?
View 1 Replies