Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General*** Displaying COleVariant variables *** Pin
Steve Lai24-Sep-00 19:25
Steve Lai24-Sep-00 19:25 
QuestionRGB to 5.6.5 translation? Pin
Erik24-Sep-00 10:33
Erik24-Sep-00 10:33 
AnswerRe: RGB to 5.6.5 translation? Pin
Feng Yuan25-Sep-00 16:10
Feng Yuan25-Sep-00 16:10 
GeneralRe: RGB to 5.6.5 translation? Pin
Erik25-Sep-00 21:32
Erik25-Sep-00 21:32 
QuestionTear-off tabs? Pin
James Corrie23-Sep-00 13:37
sussJames Corrie23-Sep-00 13:37 
AnswerI have some code, but it isn't fineshed. Pin
David Wulff25-Sep-00 5:39
David Wulff25-Sep-00 5:39 
GeneralNo Subject Pin
Anonymous23-Sep-00 13:35
Anonymous23-Sep-00 13:35 
GeneralKeyboard hooks and sending keystrokes! Pin
Mustafa Demirhan23-Sep-00 10:58
Mustafa Demirhan23-Sep-00 10:58 
Hi,
In one of my programs, i am using system-wide keyboard hooks. However, i have some problems:

1)Sometimes, my program is not notified about the keypress event. For example when i press 'i' key while using ACCESS, my program is not notified.

2)Sometimes, the program gets two notifies instead of one. For example, when i press a key on MSDN, the program thinks that i pressed the same key two times.

The source code of .dll is the following:
<br />
#define ID_CMD_KEYPRESSED	WM_USER+200<br />
// Globals for this module <br />
HWND     ghWndMain;      // Handle to main window -- used to post msgs<br />
static HHOOK    hHook;          // A handle to our installed hook <br />
static BOOL     bHookInstalled; // TRUE if hook has been installed <br />
<br />
HINSTANCE ghDLLInst; <br />
SYSTEMHOOK_API 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) <br />
	{<br />
		if (HIWORD(lParam) & 0x8000) <br />
		{<br />
			HWND h=::FindWindow(NULL,"WinScheduler");<br />
			PostMessage(h, ID_CMD_KEYPRESSED , wParam, lParam);<br />
		}<br />
	} <br />
	// If we haven't returned 1 by the time we get here, then we <br />
	// need to pass on the message to CallNextHookEx. <br />
	return (int)CallNextHookEx(hHook, code, wParam, lParam); <br />
}<br />
SYSTEMHOOK_API int WINAPI InstallHook (HWND hWnd, BOOL bCode )<br />
{ <br />
    int nReturn = 1;<br />
	ghWndMain = hWnd;  // Store app's window handle in DLL global variable <br />
<br />
    // Make sure that we are installing/removing in the proper order <br />
    if (bCode == bHookInstalled) <br />
        return 0; <br />
 <br />
    if (bCode) <br />
    { <br />
        hHook=(HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,ghDLLInst,0); <br />
        if (!hHook) <br />
            return 0; <br />
        bHookInstalled = TRUE; <br />
    } <br />
    else <br />
    { <br />
        nReturn = UnhookWindowsHookEx(hHook); <br />
        bHookInstalled = FALSE; <br />
    } <br />
    return nReturn; <br />
}<br />


If anyone knows what the problem is, please help me.

Secondly i want to ask a question about sending keystrokes:
I use
void keybd_event( <br />
BYTE bVk, // virtual-key code <br />
BYTE bScan, // hardware scan code <br />
DWORD dwFlags, // flags specifying various function options <br />
DWORD dwExtraInfo // additional data associated with keystroke <br />
); 
to send keystrokes to other applications. However, i cannot send some special characters like .,!'^+%&()=. How can i send these characters to other applications.

Thank you for your helps!

Mustafa Demirhan
GeneralStretching Bitmap Problem Pin
mirsad23-Sep-00 3:39
mirsad23-Sep-00 3:39 
GeneralRe: Stretching Bitmap Problem Pin
Feng Yuan25-Sep-00 16:08
Feng Yuan25-Sep-00 16:08 
GeneralProgress Bar (PumpMessages() function problem?) Pin
Jon22-Sep-00 15:54
Jon22-Sep-00 15:54 
GeneralRe: Progress Bar (PumpMessages() function problem?) Pin
Sam Hobbs23-Sep-00 9:00
Sam Hobbs23-Sep-00 9:00 
GeneralRe: Progress Bar (PumpMessages() function problem?) Pin
Jon23-Sep-00 17:40
Jon23-Sep-00 17:40 
GeneralRe: Progress Bar (PumpMessages() function problem?) Pin
Sam Hobbs24-Sep-00 14:43
Sam Hobbs24-Sep-00 14:43 
GeneralRe: Progress Bar (PumpMessages() function problem?) Pin
Jon24-Sep-00 15:31
Jon24-Sep-00 15:31 
GeneralCXTabCtrl and accessing Data in CDocument Pin
Brad Chase22-Sep-00 11:11
Brad Chase22-Sep-00 11:11 
Questioncommon files registry settings???? Pin
trey22-Sep-00 9:28
trey22-Sep-00 9:28 
QuestionSlider in a Tootbar Queastion? Pin
Member 204122-Sep-00 7:22
Member 204122-Sep-00 7:22 
GeneralStretching? Resize. Pin
Geon M.22-Sep-00 6:37
sussGeon M.22-Sep-00 6:37 
GeneralRe: Stretching? Resize. Pin
rial23-Sep-00 5:35
rial23-Sep-00 5:35 
QuestionHow can I open a file without typing in the full path? Pin
Erich Ruth22-Sep-00 6:37
Erich Ruth22-Sep-00 6:37 
AnswerRe: How can I open a file without typing in the full path? Pin
Paolo Messina22-Sep-00 7:21
professionalPaolo Messina22-Sep-00 7:21 
QuestionHow can I convert 12345679 to 123,456,789.00? Pin
danielle22-Sep-00 5:01
danielle22-Sep-00 5:01 
AnswerRe: How can I convert 12345679 to 123,456,789.00? Pin
Michael Dunn22-Sep-00 8:26
sitebuilderMichael Dunn22-Sep-00 8:26 
QuestionDevice Handling in C++? Pin
Rizwan Majeed22-Sep-00 1:23
professionalRizwan Majeed22-Sep-00 1:23 

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.