I am messing with a Hook program that intercepts keypresses, throughout the system, passes it onto a "server", which then dished the information out to a client on my LAN (Basically, everykey I press on 1 computer is shown on another computer)
The Dll that implements my hook procedure relays the info back to the server using a windows pipe, and the server sits with a dedicated thread using ReadFile() to take my information and send it over the network.
It all works very nice, except that I cannot get the "server" to do anything when its out of focus......I have checked my hook procedure and that is working fine, but as soon as the "server" does not have focus, the handle to the pipe is made invalid (It actually becomes NULL while the server loses focus). As soon as I restore focus its back again and working fine.......
I have tried just about everything I can think about; Moving the ReadFile to its own thread, using DuplicateHandle() to try get a better handle, using SendMessage(), Posting Messages directly to the thread with PostThreadMessage()........and so on.....but no luck.......
Its 04:21AM, I have had enough and I have no hope of further ideas tonight (there may be a simple solution...but I wont get it now)..
Oh BTW, I am using MSVC++6 and Windows 2000Pro
Thanks in advance....