Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My requirement is to get keyspressed when user opens specific URL in chrome. For that I am firstly checking for URL opened in chrome after that I am setting hook using below code


C#
if(condition==1)
{
_hookID = SetHook(_proc);
    Application.Run();
}
else if(condition==2)
{
Application.Idle += (s, e) => { UnhookWindowsHookEx(_hookID); };
    UnhookWindowsHookEx(_hookID);
}


it is getting the keys on that URL but after that if i close that URL it get the output as i want, but after closing the URL if i again open the same URL it doesnt get the keys. All i want to get the setHook function called every time when i open specific URL. Please suggest.

What I have tried:

Before this I has trouble in unfollowHookEx but i solved it by using Application.Idle method.
Posted
Updated 6-Feb-18 2:39am
v2

1 solution

There is only one reason to be doing something like that. That's to grab someone's password when they log into a certain site.

Sorry, but you're not going to get any help with this.
 
Share this answer
 
Comments
abhishekagrwl25 6-Feb-18 9:41am    
I want to get User Id for that specific URL..to stop some user to log in to other users Id.
Dave Kreskowiak 6-Feb-18 9:53am    
Yeah, that's not the way to do it and you're really not going to be able to pull that off anyway. That's up to the website to provide that kind of functionality.

Also, the hook code can always be abused to capture keystrokes to steal passwords and I have no idea what you're really using it for.

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