C# .NET - How to know Acrobat Reader Running Instance ?
Asked By svt gdwl on 15-May-09 04:52 AM
I would like to know how to detect through c# programming if Acrobat Reader or Adobe Acrobat Professional is actually running.
Thanks a lot.
Try This...
Prakash C replied to svt gdwl on 15-May-09 05:06 AM
System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("AcroRd32");
if (processes.Length >= 1)
{
Response.Write("Acrobat Running");
}
else
{
Response.Write("Acrobat Not Running");
}
Hope this helps.. :-)
Alice J replied to svt gdwl on 15-May-09 05:08 AM
Download AutoPlay Media Studio 5.0
Open the Acrobat.det file (usually in "C:\Program Files\AutoPlay Media Studio 5.0 Professional\Plugins\Detect") with winzip and extract acrobat.lua. Open acrobat.lua in a text editor. There is code you can copy and paste from there.
Re
Ravenet Rasaiyah replied to svt gdwl on 15-May-09 05:23 AM
Hi
If you need check in Win XP/Windows 2000 server
Process[] collectionOfProcess = Process.GetProcessesByName("AcroRd32");
if (collectionOfProcess.Length >= 1)
{
MessageBox.Show("Acrobet reader running");
}
If you need check in WIn 2008 server /win 2003 server, some time you may be installed Acrobat reader 64 bit edition so you need use this
Process[] collectionOfProcess = Process.GetProcessesByName("AcroRd64")
if (collectionOfProcess.Length >= 1)
{
MessageBox.Show("Acrobet reader running");
}
thank you
Use Process object
harendra singh replied to svt gdwl on 15-May-09 05:40 AM
First check the process name in tha task manager by pressing ctrl+shift+esc
string sProcessName = Process.GetProcess("Acrod32.exe");
string sCompare = "Acrod32.exe";
if(sProcessName==sCompare)
{
message.show("Its running");
}
else
{
MessageBox.Show("The application not running","Warning");
}
hi
rajesh reddy replied to svt gdwl on 15-May-09 07:07 AM
If the acrobat reader runs as boot up process the following code works.
Add the namespace: using System.Diagnostics to the class file
and here is the code
.Process[] processes =.Process.GetProcessesByName("AcroRd32");
if (processes.Length >= 1)
{
Console.Write("Acrobat Running");
}
else
{
Console.Write("Acrobat Not Running");
}
If it is not running as background process u have to open the acrobat reader and do the rest as above
can we get the reference of the file for which the AcroRd32.exe is applied. If so, How?
svt gdwl replied to Ravenet Rasaiyah on 15-May-09 07:15 AM
Of course you can take
Ravenet Rasaiyah replied to svt gdwl on 15-May-09 08:25 AM
Hi
You can access what ever you need when you got process.
Process[] collectionOfProcess = Process.GetProcessesByName("AcroRd32");
if (collectionOfProcess.Length >= 1)
{
Process acrProcess = collectionOfProcess[0];
MessageBox.Show(acrProcess.MainModule.FileName);// fil path
MessageBox.Show("Acrobet reader running");
}
any more you need? just post again.
Thank you
Result for acrProcess.MainModule.FileName:
svt gdwl replied to Ravenet Rasaiyah on 15-May-09 08:51 AM
This is the Result for acrProcess.MainModule.FileName:
C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe
I want the original filename that has been opened in acrobat reader
svt gdwl replied to Ravenet Rasaiyah on 15-May-09 08:58 AM
I was getting
acrProcess.MainModule.FileName: C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe
I want the original filename that has been opened in acrobat reader. How can I get?
OK can
Ravenet Rasaiyah replied to svt gdwl on 15-May-09 09:16 AM
Hi
You can do what ever you need.
Process[] collectionOfProcess = Process.GetProcessesByName("AcroRd32");
if (collectionOfProcess.Length >= 1)
{
Process acrProcess = collectionOfProcess[0];
MessageBox.Show(acrProcess.MainWindowTitle);// file name of the which is opened.
MessageBox.Show("Acrobet reader running");
}
thank you