VS 2008 - Running Into Some Errors - When Try To Delete An .dll File Using Kill
Apr 28, 2010
I am writing a simple program that I'm going to use to end a process and then delete a folder with its contents but, I am running into some errors when I try to delete an .dll file using Kill. I would have figured this out on my own but its being weird.
1. If I run the .exe it doesn't delete it and gives me and error
2. I i run the .exe as administrator it doesn't delete it and gives me an error
3. If I run visual basic 2008 as Administrator and then execute the program it works.
4. If I try and execute it again as Administrator under Visual Basic it doesn't work and says I don't have sufficient access.
What I am trying to do is End a Process so that I am able to delete the folder, the folder contains and .dll which is being stuborn and saying I don't have sufficient access to do this.
Kill
Public Class Form1
Public Sub killprocess(ByRef strproccesstokill As String)
Dim proc() As Process = Process.GetProcesses
How can I check if an application is running, and then kill it?I REALLY need it urgently because some random antivirus program attacked me, and it doesn't let me do ANYTHING! So I am planning to put the program on startup and kill it when it starts running.
When I made a program and tested it on the machine I have compiled it , all works well. I tested them even on my other computer works fine. Every time though when I passed the program to my friends computer or such , I got that common error message "A problem has encountered . tell Microsoft about this problem [Send Error Report] [Don't Send]. I checked my computer here is on XP SP3 with Microsoft .NET Framework 3.5 SP1 installed , same thing on my other computer. My friends computer is on an XP SP2 with Microsoft .NET Framework 3.5 (no SP1).
i have old program which is create in vb.5 i have in my PC vb.6 but when i want run program is give me a lot of error , i understand that i miss some .OCX i have this control or reference in my program 1- function MyScan(FpLibXCapture1 As FpLibXCapture, txtID As Object, LabelMessage As Label, LabelAlarm As Variant, Optional txtName As Object) Dim FpLibXVerify1 As FpLibXVerify Dim result As Boolean
Public Class Transform Dim inputFile As IO.StringReader ' Object variable Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ofdOpenFile.FileOk
[code]....
And I am getting these errors:
'Private Sub Transform_Load(sender As Object, e As System.EventArgs)' has multiple definitions with identical signatures. Line 15 'strOutputPath' is not declared. It may be inaccessible due to its protection level. Line 51 Type 'XslCompiledTransform' is not defined. Line 83
I've created a project which references some other projects in my solution. I've added the references properly to my project (which I've done a thousand times before), and used them in an Imports statement. I can successfully create references to the objects contained in the referenced namespace at design-time but whenever I attempt to build or run the project, I get build errors saying that the referenced projects do not exist. Their Imports statements change to the broken green underline and the only way to remedy the problem is to re-add the references in my project's properties.
I know that the referenced projects are valid, will compile etc... because they work fine for other projects in the solution. Also, I can go to the definition of their objects as long as I don't build/run.
This is how I update a table using DataAdapter and DataSet in VB using SQL Server[code]...
I know that the Fill method does not make sense in case of an INSERT statement, but I am new to this technology and the above statement does the job and updates the table w/o problems. My question is this: If there was an error (say a duplicate key error) how would I know this in my application? Should I be putting the above code in a try/catch block?
Also, if there is a "proper" method for running INSERT statements using a DataAdapter/DataSet combination that does not use the Fill method, please indicate that as well.
here is what I'm trying to do (partly in pseudo code):
Public Sub KillProcess(ByRef strProcessToKill As String) Dim proc() As Process = Process.GetProcesses For i As Integer = 0 To proc.GetUpperBound(0) If proc(i).ProcessName = strProcessToKill Then proc(i).Kill() End If
[Code]...
The killprocess part works fine. However, if I try a "For Each App As Process In Process.GetProcessesByName("chrome"") approach and have several chrome windows open then it will display the question 5 times if there are 5 chrome processes open.
How can be find out which file is going to delete when, user provides command like DELETE or SHIFT + DELETE or by programmatically gives DELETE command. Well I know about FileSystemWatcher Class, but this class doesn't provide information before delete...
How to create an error log system, which will log all errors(caused in my app) to a text file with line number, sub/function in which the error occurred, error details, etc. ?
Public Function RsReDir() 'function to restart dns redirector - working as of 12-11-08' Dim plist As Process() = Process.GetProcesses() 'Get and parse list of processes to plist'
For Each p As Process In plist 'parse each entry in plist as p process'
Try If p.MainModule.ModuleName.ToLower() = "dnsredir.exe" Then p.Kill() 'If module name of process matches "dnsredir.exe" then kill p' Catch
[code]....
i would like to kill and restart dnsredir.exe file but the code doesnt' seem to work?
If I want to abort or end this operation, myprocess.kill() does not work I'm thinking that the Cmd box gets killed but tsmuxer remains alive to fight another day.
myapp= joinstreams.cmd which is C:\tsmuxer.exe "C:\workSeamM2TS.meta" "C:\workSeamM2TS.m2ts" Dim myProcess As New Process() myProcess.StartInfo.WorkingDirectory = Application.StartupPath[code].....
I would like to write a sub routine to kill an executable file called 'dfsvc.exe'. I'll call this subroutine when I exit my application to kill this file. When I exit my application this file is still running and takes around 15 minutes before it disappears. I would like to kill it to remove the delay.. The following code below doesnt work..
I am trying to delete a running application is this possible. Here is what i meanIf you have a program running you know when you try to delete it, a message pops up " this program is being used Bla Bla Bla ..." want to delete that program even if its being used.
How would i kill an application, I'm creating my first project in VB and this is my code so far:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Shell("samp-server.exe") End Sub
I simply want to be able to delete a file via ftp.What irritates me is, it is so easy to upload a file but so much harder to delete a file. delete a file over FTP using visual basic?
i have a listbox that lists the contents of a .txt file, How can i make it so that when i click a button it will delete the selected line from the listbox from the file?
I need to be able to delete a file on my server through Ftp and Visual Basic.So far I know how to upload to a server but not how to delete a particular file on it.