ACCEL preLoadHK[2];
/*
typedef struct {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG;
*/
BOOL PongsAccel(HWND hwnd, ACCEL *HKTable, int size, MSG *msg)
{
BOOL pass = FALSE;
if(size > 0)
{
if(HKTable != NULL)
{
if((*msg).message == WM_CHAR)
{
/*Translate keys being pressed, CTRL+X or X or ALT+X*/
}
}
}
return pass;
}
...
while ( (bRet = GetMessage(&messages, (HWND) NULL, 0, 0)) != 0)
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
// Check for accelerator keystrokes.
if (!PongsAccel(hwnd, &preLoadHK,
ARRAYSIZE(preLoadHK),&messages))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
}
}
The numbers in lParam's description are bit positions. To get the
scan code for instance, you would use `(lParam >> 16) & 0xff`. Also
your subject is nonsense. TranslateMessage generates WM_CHAR
messages from WM_KEYDOWN.
when you press a key a WM_KEYDOWN is generated (having the virtual key
code) then a WM_CHAR is sent which has the key value (ASCII/UNICODE)
the a WM_KEYUP is generated.
u can use filtermessage for message and u can use key board hook proc
for controlling the messages(i mean the input)
please let me know what r u lookingh for in detail ...I will be glad
to help
1. Is there a site that can tell me which messages TranslateMessage
creates and which one's are in the MSG structure
2. A tutorial on working with the bits, don't really understand the
"(lParam >> 16) & 0xff", get most of it, but want to know everything I
can do with bits
3. Is there any way to peek at the messages that programs are sending
within there message loop...programs that are not owned by you.
i.e I have my program hidden, a user has a notepad open and they
write "~Program~@pen", My program which is peeking at the notepad
records the key
actions and shows the window... Though I know this could be
used for viruses and such, so I guess it wouldn't be very safe for
windows to allow this...What
about just reading keyboard actions (I've read something about
capturing the mouse, is there one for the keyboard?)
4.a Port monitoring/sending messages, so that programs can read
messages (This one is a big one I know....Really hard for MSDN to give
me straight
answers...addrs would be nice)
4.b This is an extension, I'm trying to monitor all out going messages
from my computer, is there anyway I could catch a glimpse at these
messages and copy
them to a buffer?
ok..
one thing you do
u can download the source of freedownloadmanager from sf.net
u will find most of the source you needed.
AFAIK MSDN is the best.
also u can download a network monitoring tool from sf.net
u can c the source.Its the only way to learn.
if possible i will send you sm file u may find them helpful.