Picture 1.All Process and its loaded DLLs information.
Picture 2. Filter against process name.
Picture 3. Start a new application.
Picture 4. Stop a running application.
Overview
In your computer, there may be thousands of versions of a DLL. Which version are you using? Which DLL has effectively been loaded by your effectively been loaded by your application? You must check the path, version and the current working directory of your process, etc. If you want to answer quickly, use DLL Profiler.
DLL profiler is used list all the DLLs that are currently loaded in your machine, including where they are loaded and their version number, size, modification date, product name and product version. It's an application used to find the multiple DLLs error if you start an application.
Moreover, you can start and stop an application directly here and watch it's loaded DLLs and their errors.
You can search loaded DLLs against one process only. DLL Profiler is having filter facility to look at a particular process' DLLs only.
This class demonstrates the use of following namespaces.
System.IO
System.Net
System.Diagnostics
System.Threading
System.Drawing.Drawing2D
Logger
Installation step
Just download and click an exe to run the application.
Source code
Have you ever experienced an error while loading a DLL when you start an application? Invalid DLL version? or ???
If so, It's for you.
If you want to monitor your application after you open it. You can use this.
The main idea is get all the processes running in local machine. And get all modules and appropriate details like module path, file version, file size, file modification date, file description, product name and product version.
using System;
using System.Data;
using System.Drawing;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
using Logger;
The above namespaces are must for DLL Profiler. Here, I have placed the code to reveal to you how to get running process' name and process ID.
Process[] procList = Process.GetProcesses();
for ( int i=0; i<procList.Length; i++)
{
MessgeBox.Show("Process Id=" + procList[i].Id +
"\t" + " Process Name=" + procList[i].ProcessName);
}
The following code will explain how to get modules/DLLs for appropriate process.
Process[] ObjModulesList = Process.GetProcessesByName("devenv");
ProcessModuleCollection ObjModules = ObjModulesList[0].Modules;
foreach (ProcessModule objModule in ObjModules)
{
strModulePath =GetValidString(objModule.FileName.ToString());
if (File.Exists(objModule.FileName.ToString()))
{
string strFileVersion = GetValidString(objModule.
FileVersionInfo.FileVersion.ToString());
string strFileSize = GetValidString
(objModule.ModuleMemorySize.ToString());
FileInfo objFileInfo = new
FileInfo(objModule.FileName.ToString());
string strFileModificationDate = GetValidString
(objFileInfo.LastWriteTime.ToShortDateString());
string strFileDescription = GetValidString
(objModule.FileVersionInfo.
FileDescription.ToString());
string strProductName = GetValidString
(objModule.FileVersionInfo.ProductName.ToString());
string strProductVersion = GetValidString
(objModule.FileVersionInfo.ProductVersion.ToString());
}
}
Start and stop an application
START an Application
Process myProcess = new Process();
myProcess.StartInfo.FileName = "Notepad";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
myProcess.Start();
STOP an Application
Process[] myProcesses = Process.GetProcessesByName("Notepad");
foreach(Process myProcess in myProcesses){
myProcess.CloseMainWindow();
}
To use this class, Just add a reference to your project and follow the steps and just import the Logger
reference into you project
Logging
I have used Logger here. You can use on/off logging remove as you like. People who don't know about Logger Please visit Logger in C# - An easy way for monitoring .NET applications
Moreover, If you look at this project you can get the following ideas:
- Splash screen
- Toolbar
- Coloring particular row depends on value in
DataGrid
.
- Run and stop an application through program.
That's all.
I would like to hear your opinion. Thanks in advance.