Click here to Skip to main content
15,892,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog from Plugin & TabStop Pin
guiguizk26-Jul-05 18:45
guiguizk26-Jul-05 18:45 
GeneralRe: Dialog from Plugin & TabStop Pin
anvaka26-Jul-05 20:03
anvaka26-Jul-05 20:03 
GeneralRe: Dialog from Plugin & TabStop Pin
guiguizk26-Jul-05 20:45
guiguizk26-Jul-05 20:45 
QuestionWhat do you know about Mandatory Profiles? Pin
Ian Bowler26-Jul-05 11:43
Ian Bowler26-Jul-05 11:43 
GeneralWebBrowser control and the clicking sound Pin
Peter Weyzen26-Jul-05 11:10
Peter Weyzen26-Jul-05 11:10 
GeneralRe: WebBrowser control and the clicking sound Pin
David Crow26-Jul-05 11:22
David Crow26-Jul-05 11:22 
Generalnamespace and DLL issues Pin
Joris van der Pol26-Jul-05 8:25
Joris van der Pol26-Jul-05 8:25 
GeneralKeyboard Hook in MFC -- Minor Syntax Pin
c121hains26-Jul-05 7:06
c121hains26-Jul-05 7:06 
Every example of using Keyboard hooks with MFC seems to be in a DLL. Is there any reason for this? I'm trying to do it in a separate class so my program will be all together. How do you do this? I've pasted what I have so far but the error i get is:

error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)'
None of the functions with this name in scope match the target type

//Keyboard hook callback
LRESULT CALLBACK CKeyboardHook::KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
try
{
KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam;

if (nCode >= 0)
{
if (wParam == WM_KEYDOWN)
{

BOOL bControlKeyDown = FALSE;

// Check to see if the CTRL key is pressed
bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);

if ((pkbhs->vkCode == VK_F) && bControlKeyDown)
{
SendMessage(hWnd,UWM_SETVISIBLE, 0, 0);
ShowWindow(hWnd, SW_RESTORE);
}
}
}
}
catch(...)
{
}


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

BOOL CKeyboardHook::InstallHook()
{
HINSTANCE ppI = AfxGetInstanceHandle();
hkb=SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc,ppI,0);

return TRUE;
}



---- and in the header:
class CKeyboardHook
{
public:
CKeyboardHook();

LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);

BOOL InstallHook();
... Confused | :confused:
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
David Crow26-Jul-05 8:04
David Crow26-Jul-05 8:04 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
c121hains26-Jul-05 8:14
c121hains26-Jul-05 8:14 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
David Crow26-Jul-05 9:10
David Crow26-Jul-05 9:10 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
Kuniva26-Jul-05 12:41
Kuniva26-Jul-05 12:41 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
David Crow27-Jul-05 2:46
David Crow27-Jul-05 2:46 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
Anonymous26-Jul-05 13:04
Anonymous26-Jul-05 13:04 
QuestionDoes anybody know any good WIN32 SDK sites? Pin
jinzhecheng26-Jul-05 6:51
jinzhecheng26-Jul-05 6:51 
AnswerRe: Does anybody know any good WIN32 SDK sites? Pin
David Crow26-Jul-05 7:59
David Crow26-Jul-05 7:59 
AnswerRe: Does anybody know any good WIN32 SDK sites? Pin
Anonymous26-Jul-05 13:05
Anonymous26-Jul-05 13:05 
AnswerRe: Does anybody know any good WIN32 SDK sites? Pin
Jack Puppy26-Jul-05 15:01
Jack Puppy26-Jul-05 15:01 
GeneralRe: Does anybody know any good WIN32 SDK sites? Pin
jinzhecheng27-Jul-05 3:32
jinzhecheng27-Jul-05 3:32 
Generalinsert a chart into a dialog Pin
Marc Soleda26-Jul-05 6:24
Marc Soleda26-Jul-05 6:24 
GeneralSize of a dialog box Pin
si_6926-Jul-05 5:12
si_6926-Jul-05 5:12 
GeneralRe: Size of a dialog box Pin
toxcct26-Jul-05 5:19
toxcct26-Jul-05 5:19 
GeneralRe: Size of a dialog box Pin
Renjith Ramachandran26-Jul-05 8:45
Renjith Ramachandran26-Jul-05 8:45 
Generalwinsock2: SPI problems Pin
superstition26-Jul-05 4:39
superstition26-Jul-05 4:39 
GeneralRe: winsock2: SPI problems Pin
Peter Weyzen26-Jul-05 10:21
Peter Weyzen26-Jul-05 10:21 

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.