Click here to Skip to main content
15,907,326 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Converting string to bool Pin
CPallini5-Jun-08 22:55
mveCPallini5-Jun-08 22:55 
JokeRe: Converting string to bool Pin
Jijo.Raj5-Jun-08 23:04
Jijo.Raj5-Jun-08 23:04 
JokeRe: Converting string to bool Pin
CPallini5-Jun-08 23:13
mveCPallini5-Jun-08 23:13 
JokeRe: Converting string to bool Pin
Jijo.Raj5-Jun-08 23:32
Jijo.Raj5-Jun-08 23:32 
AnswerRe: Converting string to bool Pin
sudhir_Kumar5-Jun-08 23:23
sudhir_Kumar5-Jun-08 23:23 
GeneralRe: Converting string to bool Pin
toxcct5-Jun-08 23:32
toxcct5-Jun-08 23:32 
QuestionModeless CPropertySheet Style WS_CHILD Issue. Pin
Paresh Chitte5-Jun-08 22:19
Paresh Chitte5-Jun-08 22:19 
QuestionGlobal hook problem Pin
Kosomot5-Jun-08 21:37
Kosomot5-Jun-08 21:37 
Hi,

I have a little problem with global hooks in my application. After setting the hook, the hook DLL gets attached only to two processes (the app which created the hook and a random process - last time I ran it it was Winamp;p) instead of all processes in the system.

Here's the code I use to create the hook:
void HookManager::Init(ListenerWindow *l) {
	l->GetListeners().push_back(this);

	TCHAR dllPath[MAX_PATH];
	GetCurrentDirectory(MAX_PATH,dllPath);
	
#ifdef XWS_64
	_tcscat_s(dllPath,MAX_PATH,_T("\\XWSHook64.dll"));
#else
	_tcscat_s(dllPath,MAX_PATH,_T("\\XWSHook.dll"));
#endif

	mHookInstance = LoadLibrary(dllPath);

	if(!mHookInstance)
		throw _T("Could not load the hook DLL.");

	//this is a little function I use to set the DLL's 
	//shared data segment
	void (*pfnSetSharedHookHandles)(HWND,HHOOK) = (void(*)(HWND,HHOOK))
		GetProcAddress(mHookInstance,"SetSharedHookHandles");

	HOOKPROC pfnShellHookProc = (HOOKPROC)
		GetProcAddress(mHookInstance,"ShellHookProc");

	if(!pfnSetHookHandles || !pfnShellHookProc) {
		FreeLibrary(mHookInstance);
		mHookInstance = NULL;
		throw _T("Could not locate the hook procedures.");
	}

	mShellHook = SetWindowsHookEx(WH_SHELL,pfnShellHookProc,mHookInstance,0);
	if(!mShellHook) {
		FreeLibrary(mHookInstance);
		mHookInstance = NULL;
		throw _T("Could not establish the system hook.");
	}

	pfnSetSharedHookHandles(l->GetHwnd(),mShellHook);
}

The only thing the hook DLL code really does is displaying a message box with the id of the current process in DllMain (with DLL_PROCESS_ATTACH). The ShellHookProc function doesn't do anything apart from calling CallNextHookEx().

Does anybody have an idea what can be wrong with it?

Thanks in advance,
Kosomot
AnswerRe: Global hook problem Pin
sudhir_Kumar5-Jun-08 21:43
sudhir_Kumar5-Jun-08 21:43 
GeneralRe: Global hook problem Pin
Kosomot5-Jun-08 21:57
Kosomot5-Jun-08 21:57 
AnswerRe: Global hook problem Pin
Naveen5-Jun-08 22:52
Naveen5-Jun-08 22:52 
GeneralRe: Global hook problem Pin
Kosomot5-Jun-08 23:06
Kosomot5-Jun-08 23:06 
QuestionTo create appln using Wizard. Pin
KASR15-Jun-08 20:52
KASR15-Jun-08 20:52 
AnswerRe: To create appln using Wizard. Pin
sudhir_Kumar5-Jun-08 21:46
sudhir_Kumar5-Jun-08 21:46 
GeneralRe: To create appln using Wizard. Pin
KASR15-Jun-08 22:39
KASR15-Jun-08 22:39 
QuestionRe: To create appln using Wizard. Pin
sudhir_Kumar5-Jun-08 22:48
sudhir_Kumar5-Jun-08 22:48 
AnswerRe: To create appln using Wizard. Pin
KASR15-Jun-08 22:54
KASR15-Jun-08 22:54 
QuestionConvert .xls(Excel)File To filtered html file Using automation Pin
hitonly20085-Jun-08 20:23
hitonly20085-Jun-08 20:23 
Questionstatus bar problem Pin
Mohanraj D5-Jun-08 19:49
Mohanraj D5-Jun-08 19:49 
AnswerRe: status bar problem Pin
_AnsHUMAN_ 5-Jun-08 20:04
_AnsHUMAN_ 5-Jun-08 20:04 
AnswerRe: status bar problem Pin
Cedric Moonen5-Jun-08 20:05
Cedric Moonen5-Jun-08 20:05 
GeneralRe: status bar problem Pin
Mohanraj D5-Jun-08 23:50
Mohanraj D5-Jun-08 23:50 
AnswerRe: status bar problem Pin
SandipG 5-Jun-08 20:09
SandipG 5-Jun-08 20:09 
AnswerRe: status bar problem Pin
sudhir_Kumar5-Jun-08 21:54
sudhir_Kumar5-Jun-08 21:54 
GeneralRe: status bar problem Pin
Cedric Moonen5-Jun-08 22:11
Cedric Moonen5-Jun-08 22:11 

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.