Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to create a event whenever user runs an application...
for thats what I've got from here...

public partial class Form1 : Form
        public System.Management.ManagementEventWatcher mgmtWtch;
        public Form1()
            mgmtWtch = new System.Management.ManagementEventWatcher("Select * From Win32_ProcessStartTrace");
            mgmtWtch.EventArrived += new System.Management.EventArrivedEventHandler(mgmtWtch_EventArrived);
        private void mgmtWtch_EventArrived(object sender, System.Management.EventArrivedEventArgs e)

which is working fine in 32bit windows but I didn't work on 64 bit window gives an exception of "Access Denied"
Sergey Alexandrovich Kryukov 18-Sep-11 17:54pm    
What are the 32-bit and 64-bit systems you used?

1 solution

Most likely your 64-bit system is Windows 7 (Vista?) where you have to run the application with elevated privileges. Logging the system in as administrator is not enough, use "Run this Program as an Administrator". You can create a shortcut "*.lnk" file to run your application requesting elevated privileges.

See this article for more detail:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900