Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

sogou09

@sogou09
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can't Activate Window C++ [modified]
    S sogou09

    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

    C / C++ / MFC c++ business
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups