.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to kill process my application has started

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :.NET Framework
Hi,  I've got a windows forms application that opens instances of another application through a WebBrowser control. On exit / exception I want to make sure that 3rd party application closes.    The following code kills the app ok but I want to make sure it will only end the process if it was started by my application   string processName = "Plugin"; Process[] processes = Process.GetProcessesByName(processName); foreach (Process process in processes) { process.Kill(); } Does processes consider all processes or just those started by my application? On testing it seems to close all. Thanks, Ian

View Complete Post

More Related Resource Links

SSRS Report Builder "Application cannot be started, contact application vendor"

Hi   In Report Manager, when i click on report builder its show me an error like "Application cannot be started, contact application vendor " I installed .net framework 2.0, I'm using windows 7,Sql server 2005 Can any one please help on this...   Thanks Sharon

Accessing memory of a remote process (x64) from application (x86) - and the other way

Hi everyone, My program access a remote process, e.g. to get the text of ListViewItem. It uses ReadProcessMemory, WriteProcessMemory, SendMessage, LV_ITEM via PInvoke. Below is a little codesnippet. This doesnt work, when i compile for x86 and the remote process is x64 (or the other way). I know that is because the size of IntPtr - and so of the LV_ITEM-Structure - is different. Is there any way, to access x86 and x64 remote processes from the same application?  Is there any way to find out if the remote process is x86 or x64 and make my call's with a suitable LV-Item Structure? thanks Torsten Codesnippet: LV_ITEM lvitem = new LV_ITEM(); // Allocate memory in the remote process's address space string s = string.Empty; IntPtr pszTextMemory = VirtualAllocEx(hProcess,IntPtr.Zero,  1024, (int)(AllocationType.MEM_RESERVE|AllocationType.MEM_COMMIT), (int)(AccessProtectionType.PAGE_READWRITE)); lvitem.pszText = pszTextMemory; ... IntPtr pLVItemMemory = VirtualAllocEx(hProcess, IntPtr.Zero,  Marshal.SizeOf(lvitem), (int)(AllocationType.MEM_RESERVE|AllocationType.MEM_COMMIT), (int)(AccessProtectionType.PAGE_READWRITE)); IntPtr lvItemPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvitem)); Marshal.StructureToPtr(lvitem,lvItemPtr,false); WriteProcessMemory(hProcess, pLVItemMemory, ref lvitem, Marshal.SizeOf(lvitem), ref written); SendMessage(hListView, LVM_GETITEM

Import Error: Could not process the file Documents/Application Deployment.mht as a Single File Web P

Hi there everyone, Version: Windows Sharepoint Services 3.0 with Cumulative Update June 29, 2010 applied. I am having issues importing an exported site into a different domain. I've overcome most of the issues and actually got most of the site to import, however, the import process get's stuck on import a Single File Web Page document from a document library. I believe the original cause of this error is http://support.microsoft.com/kb/980079 The issue I face now is, I already have a large number of .mht files in my document library which I do need to import into the test environment (or that I might need to restore in a DR scenario). Does anyone have any information on either: forcing the import commmand to "on error resume next" (ie. not stop processing when it encounters an error) fixing the already corrupt .mht files in the database easily The error text from the import command is: Error: Could not process the file Documents/Application Deployment.mht as a Single File Web Page document. at Microsoft.SharePoint.Library.SPRequest.CreateOrUpdateFileAndItem(String bstrUrl, String bstrWebRelativeUrl, Guid& docId, Object varDoc, Int32 docLength, Int32 exists, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Int32 iVersion, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String checkInComment, Int3

Process and conecction logger what is smartest to do??? C# application

I need to make Process logger and IP connection logger... I know the code but the problem is how to make it most optimal... The most optimal way to do this is to log the new processes and connection every time new process and connection appears. But i dont know if that kind event exists in C#. Of course you can check actively every second if there is new processes or connections on the PC but that would take lot of time on the CPU wich will cause bad performance on the other applications you run on the PC... Ispecially if you run netstat - anob on XP PC... I also thought about IDLE timer wich will only do logging when you use mouse and keyboard events but that does not improve performance while you work on the PC...because it will logg anyway every time mouse or keyboard event is triggered... so is there any smart way to do this or should i just set the logger to log every second??? THANKS!!! :D

.tmp file created after process crash when application upgraded to 2.0

After upgrading an asp.net application to 2.0 from 1.1 I am receiving a large 100+MB .tmp file in C:\Temp on the web server when the w3wp process serving that application crashes. If you open the file it looks like it is some sort of dump file. Any ideas how to turn this off. I know what is crashing the application and process. Any help is appreciated. Thanks

is possible to pass some data to a wpf started with Process.start?

is possible to pass some data to a wpf application started with     Process.start?

Will sessions kill when application error occurs which is in global.aspx


can you please tell Will sessions kill when application error occurs which is in global.aspx ?



void Application_Error(object sender, EventArgs e)




Kill/terminate/stop the main application




I have a winforms application.

From the main application i am starting another app using the following code:


System.Diagnostics.Process.Start(Application.StartupPath &

"\Update.exe", arg)


When this app starts, i want to kill the main app. Close the open application.

how can i do it?

There is aprocess.kill but it is not taking any  arguments. How can i kill the main app from the second app?



Estimate and Job Process application development idea


Hello all,

I am trying to develop one application, which will serve the purpose of estimation and job process management system. For estimation, I have category, subcategory and product. Estimate has different types. Each product has different properties.

At the time of estimation, user selects the product based on subcategory. Based on criteria and input, new value generated for each time for same product. Now I have to save this all products into estimate table. One estimate has multiple products.

After estimate approved, job will be created based on estimate. Job will take input all the items/products from estimate and then process each item.

My question is what is best way to do this?

Should I keep only one table estimate-detail(like order-order details scenario) which has all selected products and use it at the time of job process? Or Should I create another table for job detail?

I am novice in asp.net and searching best practices for this kind of application? Please try to describe in detail.

Thank you for your time!!!






Force fully kill a process in windows service?


Hi all, I am working on a windows service in which i execute a power point exe. I want to stop this exe after a perticular time duration.My code is something like this:

process1.Start(); // Process object to call the exe.
StreamReader myStreamReader = process1.StandardOutput;
StreamReader myStreamError = process1.StandardError;
string myID = myStreamReader.ReadLine();
string stdError = myStreamError.ReadLine();
if (process1.WaitForExit(int.Parse(ConfigurationSettings.AppSettings["PPTIMPMAX"]) * 1000))
processChk = 1;

Varun Kumar

Error running Document Aprpoval Process application sample


Hi all,

I download and install the application samples for Windows Workflow Foundation 4 on my machine. When I try to run the Document Approval Process example the ApprovalManager project runs fine but when I start the ApprovalClient.exe I run into problems. Can anybody help?

My environment is: Windows 7 64-bit with VS2010. The only change I have made is that the Express Db's name is '(local)' instead of 'localhost\SQLExpress' and I have changed this in the App.Config file.

Thanks in advance for your help.


Here is the error files:


<?xml version="1.0" encoding="UTF-16"?>
    <MATCHING_FILE NAME="ApprovalClient.exe" SIZE="36864" CHECKSUM="0xA99D9EE4" BIN_FILE_VERSION="1.0.3971.16290" BIN_PRODUCT_VERSION="1.0.3971.16290" PRODUCT_VERSION="1.0.3971.16290" FILE_DESCRIPTION="Microsoft.Samples.DocumentApprovalProcess.ApprovalClient" COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Windows Communication Foundation and Windows Workflow Foundation SDK" FILE_VERSION="1.0.3971.16290" ORIGINAL_FILENAME="ApprovalClient.exe" INT

Not able to fetch data for Application Domains related to .NET Framework 4.0 Process


We want to enumerate all .NET Framework 4.0 Processes on a particular machine. And then want to enumerate Application Domains for those processes.

After enumerating Application Domains, we want to fetch data about each Application Domain using following APIs.




We tried this using ICorPublishAppDomain Interface as well as following code :

ICLRMetaHost *meta; 

Microsoft's Collaborative Application Markup Language (CAML) Loop

discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is:

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Getting Started with Windows SharePoint Services

Of all of the capabilities of SharePoint, I thought I would start with the most basic installation - as a corporate intranet. It is likely that we will need to discuss some of the elements of SharePoint as we go along, so this also gives us the opportunity to review these elements for future reference.

Before going into too much detail, I would like to point out that you can try the core SharePoint framework (known as Windows SharePoint Services or WSS) for free. On Microsoft's Web site you can download a trial version of Virtual PC 2004 (VPC). Using VPC, you can install the Windows 2003 Evaluation Kit and the WSS add-on. This combination will give you 45 days to evaluate the setup.

Integrating a Legacy Web Application in SharePoint

This month we will continue with the theme of deploying Microsoft's SharePoint as a company intranet by describing a method for integrating a legacy Web application inside a SharePoint site.

In many companies the intranet site is not just a home page with announcements. It houses Web applications used by many different departments. In last month's article, I built a page to search the employee table in Northwind (the sample database included in Microsoft's SQL Server). This month, I will move the Web pages used to add/remove records from the table into the SharePoint intranet.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend