Click here to Skip to main content
16,012,025 members

Comments by sachin Bhosale @ code (Top 5 by date)

sachin Bhosale @ code 12-Jun-14 0:35am View    
Actually, I want to store FOS to Sql Server.
sachin Bhosale @ code 12-Jun-14 0:26am View    
I will try this !
sachin Bhosale @ code 6-Jun-14 4:54am View    
I am using HookManager to monitor activities of Keyboard and mouse in Async Mode as register event handler in background worker process but , i am getting error 126 i.e Specified module is not Found.Does it work in Async Mode?
sachin Bhosale @ code 6-Jun-14 4:53am View    
I am using class library specified in at:

http://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C

and
code
if (s_KeyboardHookHandle == 0)
{
//See comment of this field. To avoid GC to clean it up.
s_KeyboardDelegate = KeyboardHookProc;
//install hook
s_KeyboardHookHandle = SetWindowsHookEx(
WH_KEYBOARD_LL,
s_KeyboardDelegate,
Marshal.GetHINSTANCE(
Assembly.GetExecutingAssembly().GetModules()[0]),
0);

gives me error 126
sachin Bhosale @ code 6-Jun-14 4:50am View    
private static void EnsureSubscribedToGlobalKeyboardEvents()
{
// install Keyboard hook only if it is not installed and must be installed
if (s_KeyboardHookHandle == 0)
{
//See comment of this field. To avoid GC to clean it up.
s_KeyboardDelegate = KeyboardHookProc;
//install hook
s_KeyboardHookHandle = SetWindowsHookEx(
WH_KEYBOARD_LL,
s_KeyboardDelegate,
Marshal.GetHINSTANCE(
Assembly.GetExecutingAssembly().GetModules()[0]),
0);
//If SetWindowsHookEx fails.
if (s_KeyboardHookHandle == 0)
{
//Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
int errorCode = Marshal.GetLastWin32Error();
//do cleanup

//Initializes and throws a new instance of the Win32Exception class with the specified error.
throw new Win32Exception(errorCode);
}
}
}