Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSTL string case conversion Pin
Indrawati24-May-04 15:52
Indrawati24-May-04 15:52 
GeneralRe: STL string case conversion Pin
Christian Graus24-May-04 17:25
protectorChristian Graus24-May-04 17:25 
GeneralRe: STL string case conversion Pin
Andrew Walker24-May-04 22:27
Andrew Walker24-May-04 22:27 
Generalthreads and modeless dialogs Pin
kfaday24-May-04 15:51
kfaday24-May-04 15:51 
GeneralRe: threads and modeless dialogs Pin
David Crow25-May-04 2:20
David Crow25-May-04 2:20 
GeneralSerial Communication Problem Pin
mhar24-May-04 15:36
professionalmhar24-May-04 15:36 
GeneralRe: Serial Communication Problem Pin
Kamyar Souri24-May-04 20:02
Kamyar Souri24-May-04 20:02 
Generalsize of a compiled exe Pin
locoone24-May-04 15:33
locoone24-May-04 15:33 
GeneralRe: size of a compiled exe Pin
kfaday24-May-04 15:39
kfaday24-May-04 15:39 
GeneralRe: size of a compiled exe Pin
temp1@vasr.net24-May-04 16:12
susstemp1@vasr.net24-May-04 16:12 
GeneralRe: size of a compiled exe Pin
Maxwell Chen24-May-04 17:58
Maxwell Chen24-May-04 17:58 
GeneralRe: size of a compiled exe Pin
Michael Dunn24-May-04 18:01
sitebuilderMichael Dunn24-May-04 18:01 
GeneralRe: size of a compiled exe Pin
Michael Dunn24-May-04 18:00
sitebuilderMichael Dunn24-May-04 18:00 
GeneralRe: size of a compiled exe Pin
locoone25-May-04 6:42
locoone25-May-04 6:42 
GeneralRe: size of a compiled exe Pin
David Crow25-May-04 2:24
David Crow25-May-04 2:24 
GeneralHooks and Message Blocking Pin
User 1278224-May-04 15:09
User 1278224-May-04 15:09 
GeneralRe: Hooks and Message Blocking Pin
Ryan Binns24-May-04 18:22
Ryan Binns24-May-04 18:22 
GeneralRe: Hooks and Message Blocking Pin
User 1278224-May-04 18:47
User 1278224-May-04 18:47 
GeneralRe: Hooks and Message Blocking Pin
Blake Miller25-May-04 14:53
Blake Miller25-May-04 14:53 
GeneralRe: Hooks and Message Blocking Pin
User 1278225-May-04 15:24
User 1278225-May-04 15:24 
GeneralRe: Hooks and Message Blocking Pin
Blake Miller25-May-04 15:31
Blake Miller25-May-04 15:31 
GeneralRe: Hooks and Message Blocking Pin
User 1278225-May-04 15:42
User 1278225-May-04 15:42 
I'm using separate functions for the hook. They are below:

LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if(HC_ACTION==nCode)
	{
		switch(wParam)
		{
		case WM_MOUSEMOVE:
		case WM_NCMOUSEMOVE:
			PostMessage(g_hWnd,g_hMouseMove,wParam,lParam);
			break;

		default:
			PostMessage(g_hWnd,g_hMouseAct,wParam,lParam);
				break;
		}
	}

	if(g_bBlock)
		return -1;

	return CallNextHookEx(g_hHookMouse,nCode,wParam,lParam);
}

LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if(HC_ACTION==nCode)
	{
		PostMessage(g_hWnd,g_hKeyboard,wParam,lParam);
	}

	if(g_bBlock)
		return -1;
	return CallNextHookEx(g_hHookKey,nCode,wParam,lParam);
}


I install the hooks with this:

g_hHookMouse=SetWindowsHookEx(WH_MOUSE,MouseProc,g_hInst,0);
if(NULL==g_hHookMouse)
    return FALSE;

g_hHookKey=SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,g_hInst,0);
if(NULL==g_hHookKey)
    return FALSE;


If g_bBlock is true, then it will block the mouse messages and the keyboard messages, though my app will still be able to process the mouse messages, but not the keyboard messages.

Maybe I misunderstood you, please tell me if I did.

modified 12-Jul-20 21:01pm.

GeneralRe: Hooks and Message Blocking Pin
Blake Miller25-May-04 16:01
Blake Miller25-May-04 16:01 
GeneralRe: Hooks and Message Blocking Pin
User 1278225-May-04 16:36
User 1278225-May-04 16:36 
GeneralRe: Hooks and Message Blocking Pin
Blake Miller26-May-04 7:09
Blake Miller26-May-04 7:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.