His code was written in VS 2003 and I'm using VS 2005. I implemented
his code into my project and it threw an exception...
System.Exception was unhandled
Message="SetWindowsHookEx failed."
Source="rsmm"
StackTrace:
at GlobalHookDemo.UserActivityHook.Start() in C:\Documents and
Settings\Administrator\My Documents\Visual Studio
2005\Projects\rsmm\rsmm\UserActivityHook.cs:line 123
at GlobalHookDemo.UserActivityHook..ctor() in C:\Documents and
Settings\Administrator\My Documents\Visual Studio
2005\Projects\rsmm\rsmm\UserActivityHook.cs:line 29
at rsmm.Form1.Form1_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\rsmm\rsmm\Form1.cs:line 21
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef
hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at rsmm.Program.Main() in C:\Documents and
Settings\Administrator\My Documents\Visual Studio
2005\Projects\rsmm\rsmm\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
If anybody could help I really need it. :)