Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: DoDataExchange VS SendMessage(hDialogwnd,WM_SETTEXT Pin
CPallini22-Feb-09 22:53
mveCPallini22-Feb-09 22:53 
AnswerRe: DoDataExchange VS SendMessage(hDialogwnd,WM_SETTEXT Pin
ForNow23-Feb-09 2:14
ForNow23-Feb-09 2:14 
GeneralRe: DoDataExchange VS SendMessage(hDialogwnd,WM_SETTEXT Pin
CPallini23-Feb-09 2:17
mveCPallini23-Feb-09 2:17 
GeneralRe: DoDataExchange VS SendMessage(hDialogwnd,WM_SETTEXT Pin
ForNow23-Feb-09 12:23
ForNow23-Feb-09 12:23 
QuestionLinux junkies and programmers Pin
Michael Randolph22-Feb-09 5:57
Michael Randolph22-Feb-09 5:57 
AnswerReported as abuse. Pin
CPallini22-Feb-09 9:12
mveCPallini22-Feb-09 9:12 
GeneralRe: Reported as abuse. Pin
Perspx22-Feb-09 9:23
Perspx22-Feb-09 9:23 
QuestionCan't Activate Window C++ [modified] Pin
sogou0922-Feb-09 4:42
sogou0922-Feb-09 4:42 
Hi Guys

I have a business full screen appliection (A.exe) run in Windows 98.
I need a hotkey when the appliection is running,Press SPACE key ,Excute a Dialog based program "C.EXE".
I try to use "RegisterHotKey" function ,But the hot key does not work.
Now I try to use Keyboard hook, I create a Dialog based program "B.exe" and "B.dll",When "B.exe"
excuted,It launched hook callback function in "B.dll".

Excute Sequence :B.exe A.exe

when A.exe is running ,I press SPACE key,the hook function catch the keyboard message,
it call C.exe (use the "ShellExcute"),The window of C.exe appear.

Qustion: The window of "C.exe" isn't current active window.the window of "A.exe" is active windows yet!
I need the window of C.exe is active when it appeared.


LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	BOOL fEatKeystroke = FALSE;
	PKBDLLHOOKSTRUCT p = NULL;
	if (nCode == HC_ACTION) 
	{
		p = (PKBDLLHOOKSTRUCT) lParam;
		switch (wParam) 
		{
			case WM_KEYDOWN: 
				if (p->vkCode == VK_SPACE)
				{
					return 1;
				}
				break;
			case WM_KEYUP:    
			
				if (p->vkCode == VK_SPACE)
				{
					ShellExecute(NULL,"open","C:\\C.exe",NULL,NULL,SW_SHOW);
					HWND h=FindWindow(NULL,"Caption of C");
					if(h) 
                                          {
                                                ShowWindow(h,SW_SHOW);
                                          }
                                          return 1;
				}
				break;	
			default:
				break;
     		}
		
	}
  	return (CallNextHookEx(glhHook,nCode,wParam,lParam));
}


void _stdcall StartKeyMask()
{
	glhHook = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,glhInstance,0);
}

void _stdcall StopKeyMask()
{
	if (glhHook!=NULL)
		UnhookWindowsHookEx(glhHook);
}


modified on Sunday, February 22, 2009 10:53 AM

AnswerRe: Can't Activate Window C++ Pin
Dr. Emmett Brown22-Feb-09 4:55
Dr. Emmett Brown22-Feb-09 4:55 
GeneralRe: Can't Activate Window C++ Pin
guamp22-Feb-09 5:36
guamp22-Feb-09 5:36 
GeneralRe: Can't Activate Window C++ Pin
Graham Bradshaw22-Feb-09 11:06
Graham Bradshaw22-Feb-09 11:06 
QuestionHow to implement an STL or similar Pin
Member 357350622-Feb-09 0:52
Member 357350622-Feb-09 0:52 
AnswerRe: How to implement an STL or similar Pin
CPallini22-Feb-09 2:54
mveCPallini22-Feb-09 2:54 
QuestionCan I comment OBJECT_ENTRY_AUTO Pin
pandit8421-Feb-09 23:51
pandit8421-Feb-09 23:51 
AnswerRe: Can I comment OBJECT_ENTRY_AUTO Pin
CPallini22-Feb-09 2:58
mveCPallini22-Feb-09 2:58 
QuestionHow could i find the '\t' in a file [modified] Pin
Archy_Yu21-Feb-09 16:20
Archy_Yu21-Feb-09 16:20 
AnswerRe: How could i find the '\t' in a file Pin
«_Superman_»21-Feb-09 19:09
professional«_Superman_»21-Feb-09 19:09 
GeneralRe: How could i find the '\t' in a file Pin
Archy_Yu21-Feb-09 19:13
Archy_Yu21-Feb-09 19:13 
Questionwin32 dll in visual studio 6.0 VS visual studio 2005/2008 questions Pin
Greg Ellis21-Feb-09 15:10
Greg Ellis21-Feb-09 15:10 
AnswerRe: win32 dll in visual studio 6.0 VS visual studio 2005/2008 questions Pin
Gary R. Wheeler21-Feb-09 15:50
Gary R. Wheeler21-Feb-09 15:50 
AnswerRe: win32 dll in visual studio 6.0 VS visual studio 2005/2008 questions Pin
«_Superman_»21-Feb-09 19:11
professional«_Superman_»21-Feb-09 19:11 
AnswerRe: win32 dll in visual studio 6.0 VS visual studio 2005/2008 questions Pin
Stuart Dootson22-Feb-09 13:46
professionalStuart Dootson22-Feb-09 13:46 
Questiona short code for basic graphics Pin
Redribs21-Feb-09 14:02
Redribs21-Feb-09 14:02 
AnswerRe: a short code for basic graphics Pin
Stephen Hewitt21-Feb-09 22:18
Stephen Hewitt21-Feb-09 22:18 
AnswerRe: a short code for basic graphics Pin
Iain Clarke, Warrior Programmer23-Feb-09 4:45
Iain Clarke, Warrior Programmer23-Feb-09 4:45 

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.