Killing a process

vanwero
Member Posts: 28
Hi,
does anybody know how you can kill a running program from within code?
Ex: how can I end the Acrobat Reader from within Navision Code?
(Without working with "automation". Just an independent program!)
Thanks a lot!!
Greets,
R.
does anybody know how you can kill a running program from within code?
Ex: how can I end the Acrobat Reader from within Navision Code?
(Without working with "automation". Just an independent program!)
Thanks a lot!!
Greets,
R.
0
Comments
-
pskill should do the trick
It comes with the Windows SDK toolkit.
Greetings,Now, let's see what we can see.
...
Everybody on-line.
...
Looking good!0 -
I needed to accomplish this for some functionality that triggered Acrobat reader sessions from within Navision. I ended up writing a VB DLL with a function to kill all instances of Acrobat...obviously you just need to be careful that the user doesn't have any other valid Acrobat sessions open (I'll leave that to you to handle!). And the other downside is needing to install a DLL on each workstation. Anyway, the function itself is:
Private Function KillAcrobatSessions()
On Error GoTo FunctionErr
Dim wmi, wmiq, colProcesses, process As Object
'Kill any acrobat sessions
Set wmi = GetObject("winmgmts:")
'-- Query for active acrobat reader processes
wmiq = "select * from Win32_Process where name='AcroRd32.exe'"
Set colProcesses = wmi.ExecQuery(wmiq)
For Each process In colProcesses
process.Terminate (1)
Next
Set colProcesses = Nothing
Set wmi = Nothing
FunctionErr:
End FunctionRob Hansen
http://www.epimatic.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions