Click here to Skip to main content
16,004,887 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HOOKs again and again Pin
Feng Yuan www.fengyuan.com12-Sep-00 8:32
sussFeng Yuan www.fengyuan.com12-Sep-00 8:32 
GeneralIn memory PE execution Pin
Janez Novak10-Sep-00 21:12
Janez Novak10-Sep-00 21:12 
GeneralRe: In memory PE execution Pin
Feng Yuan www.fengyuan.com12-Sep-00 8:30
sussFeng Yuan www.fengyuan.com12-Sep-00 8:30 
GeneralRe: In memory PE execution Pin
Janez Novak13-Sep-00 22:11
Janez Novak13-Sep-00 22:11 
GeneralMessagebox language translation Pin
John Self10-Sep-00 16:57
sussJohn Self10-Sep-00 16:57 
Generalsending messages to other programs Pin
vik10-Sep-00 12:50
vik10-Sep-00 12:50 
GeneralRe: sending messages to other programs Pin
Member 120896511-Sep-00 10:25
Member 120896511-Sep-00 10:25 
GeneralHOOKs again Pin
Mustafa Demirhan10-Sep-00 10:46
Mustafa Demirhan10-Sep-00 10:46 
I am in trouble with hooks. I have entered the following code to my programs main view's .cpp file:
<br />
HHOOK m_hhk;<br />
static LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam);<br />
<br />
void CWinSchedulerView::OnInitialUpdate() <br />
{<br />
        CFormView::OnInitialUpdate();<br />
	m_hhk = SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,NULL,GetCurrentThreadId());<br />
}<br />
<br />
static LRESULT CALLBACK KeyboardProc(<br />
	int code,       // hook code<br />
	WPARAM wParam,  // virtual-key code<br />
	LPARAM lParam)  // keystroke-message information<br />
{<br />
	if (code < 0 || code != HC_ACTION)<br />
		return CallNextHookEx(m_hhk, code, wParam, lParam);<br />
	if (wParam == VK_F1)<br />
	{<br />
		AfxMessageBox("F1");<br />
	}<br />
	return CallNextHookEx(m_hhk, code, wParam, lParam);<br />
}<br />
<br />
void CWinSchedulerView::OnDestroy() <br />
{<br />
	CFormView::OnDestroy();<br />
	<br />
	UnhookWindowsHookEx(m_hhk);	<br />
}<br />


Well, this works well if i press F1 wheh the active window is my window. However, when i press F1 on another window it does not work. If someone tell me the problem, i will be very glad.

Thanks in advance for any helps
Mustafa Demirhan
GeneralRe: HOOKs again Pin
Michael Dunn10-Sep-00 11:44
sitebuilderMichael Dunn10-Sep-00 11:44 
GeneralRe: HOOKs again Pin
Sam Hobbs10-Sep-00 14:55
Sam Hobbs10-Sep-00 14:55 
GeneralRe: HOOKs again Pin
Sam Hobbs10-Sep-00 15:22
Sam Hobbs10-Sep-00 15:22 
GeneralI'm new and i need help with html and all Pin
Alex98065410-Sep-00 10:26
Alex98065410-Sep-00 10:26 
GeneralRe: I'm new and i need help with html and all Pin
Philip Nicoletti10-Sep-00 12:56
Philip Nicoletti10-Sep-00 12:56 
GeneralAbout bitmaps on dialog Pin
Eq9-Sep-00 17:39
Eq9-Sep-00 17:39 
GeneralUsing HOOKs Pin
Mustafa Demirhan9-Sep-00 0:44
Mustafa Demirhan9-Sep-00 0:44 
GeneralRe: Using HOOKs Pin
Sam Hobbs9-Sep-00 17:22
Sam Hobbs9-Sep-00 17:22 
GeneralRe: Using HOOKs Pin
Marcelo Guerra26-Dec-00 6:47
Marcelo Guerra26-Dec-00 6:47 
GeneralMoney 2000 Pin
pankaj8-Sep-00 21:07
pankaj8-Sep-00 21:07 
GeneralRe: Money 2000 Pin
David Wulff10-Sep-00 10:58
David Wulff10-Sep-00 10:58 
GeneralSetWindowLong Pin
Jamie Nordmeyer8-Sep-00 14:13
Jamie Nordmeyer8-Sep-00 14:13 
GeneralRe: SetWindowLong Pin
Michael Dunn8-Sep-00 20:57
sitebuilderMichael Dunn8-Sep-00 20:57 
GeneralRe: SetWindowLong Pin
Jamie Nordmeyer11-Sep-00 7:55
Jamie Nordmeyer11-Sep-00 7:55 
GeneralRe: SetWindowLong Pin
Michael Dunn11-Sep-00 8:16
sitebuilderMichael Dunn11-Sep-00 8:16 
GeneralRe: SetWindowLong Pin
Sam Hobbs11-Sep-00 17:50
Sam Hobbs11-Sep-00 17:50 
GeneralRich Edit Question Pin
Mihalcik8-Sep-00 8:25
sussMihalcik8-Sep-00 8:25 

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.