![]() |
|
#1
|
|||
|
|||
Keyboard hook weird problems.Im creating a hook to catch the text from users input when pressed F8, and it gets sent to a mirc channel window's edit box as soon as you press F7.But there are two weird problems
First one is that it doesnt work on background.F8 works on background, but the code in the hook doesnt work at background..Whats wrong? Second, when I press F8 then type something then press F7, everything goes fine, but when I want to do it another time, without restarting, I get this error message sound as soon as I press F7, but nothing happens.I checked, and it did write the file, also checked if it executed the send messages, and it did.Whats wrong? Pasting the whole code here.Including headers. /\DLL -=============DLLMAIN.CPP CPP / C++ / C Code:
-===============DLL.H CPP / C++ / C Code:
/\Program -================MAIN.CPP CPP / C++ / C Code:
-===============mainh.h CPP / C++ / C Code:
Sorry that I pasted this much code, but I feel like it can be in either the DLL or the program. |
|
#2
|
||||
|
||||
Re: Keyboard hook weird problems.Not sure about all the 'hooking', but could GetAsyncKeyState() possibly work for you? I'll have to post more later, for I can't get into specifics right now.
|
|
#3
|
|||
|
|||
Re: Keyboard hook weird problems.GetAsyncKeyState is only for 1 key, not for the all of them at the same time??
|
|
#4
|
||||
|
||||
Re: Keyboard hook weird problems.I guess I may not be sure about what you are trying to accomplish, but I assumed you were looking for only the F7 & F8 keys?
I was thinking something along these lines: CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Re: Keyboard hook weird problems.No not really.The F8 and F7 keys work fine, but its about the 'normal' keys like 'a' and so on, I need to track those.Thats done in the DLL with GetKeyboardState() which copies all button values to a variable.THAT one doesnt work on background.
|
|
#6
|
|||
|
|||
Re: Keyboard hook weird problems.I think you're trying to capture the string the user types after F7 and before F8, right? Not just one character? If I'm right, GetKeyboardState() is not what you want. That just takes a "snapshot" of the keyboard. You probably need to create a window with a text box to capture the input.
By the way, defining a function SendMessage(), which is the same name as the very common Win32 function, is probably a bad idea (while C++ overloading will sort it out, the same name in your code will get confusing) |
|
#7
|
|||
|
|||
Re: Keyboard hook weird problems.ubergeek: ..It is the other way around
But yes, I wanna the capture the string after F8 and before F7.And I want it to work on background I dont think the textbox will catch the keys on background? But using such a textbox would be more efficient, as i dont have to use the file writing anylonger, but it must work on background. |
|
#8
|
|||
|
|||
Re: Keyboard hook weird problems.why not do this (pseudocode):
Code:
My way, the program site in the background listening for F8, and then it comes to the foreground to capture text (this way the user can see what they are typing, as well) and then goes away again when F7 is pressed |
|
#9
|
|||
|
|||
Re: Keyboard hook weird problems.Its a very good idea.I perfectly understand what you are trying to do, which is very smart.Ill try it today, and paste the code asap, so you can see what happened to it.
Ill try it, but im not sure whether the game will alt-tab after showing the window. |
|
#10
|
|||
|
|||
Re: Keyboard hook weird problems.Made the program, but as I already thought, showing it in the game is a problem
CPP / C++ / C Code:
Dont pay any attention to those file write stuff, there just to test, ill remove em later. |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems while burning CD's | netnut | Computer Software Forum - Windows | 16 | 18-Jan-2008 00:45 |
| Problems with my first pc build | davro | Computer Hardware Forum | 5 | 29-Jul-2006 15:11 |
| Weird Toolbar and Statusbar autosizing Problems | Szabadember | C++ Forum | 1 | 26-Jul-2005 15:56 |
| Chaintech Geforce 5600 FX problems | bartster74 | Computer Hardware Forum | 8 | 04-May-2004 14:16 |
| list of the most common keyboard and mouse shortcuts for IE, Opera and Firebird | jrobbio | Computer Software Forum - Windows | 2 | 04-Sep-2003 10:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The