NT "Hot Key" - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

NT "Hot Key"

I run virtual Dos Boxes across a network. My Autoexec.nt

logs me into many servers. I would like to assign a

"hot key" (i.e. ALT + P) that would type my password for

me. Can I do this?






Comments

  • I wrote an app that does something like that once, types a certain text to where the caret is, for that i used the keybd_event API(), straight forward.

    Now the hard part, keeping the keyboard focus in the old app when a task switch occurs, my app was on 95/98 only so i used a timer and the ThreadWalk API from the toolhelp sdk, AttachThreadInput() to every thread so that WM_SETFOCUS would have the correct hWnd in wParam (old focus) and not NULL. It's a lousy technique and I'm sure there are better ways! But I hope I atleast showed you of how NOT to do it :)


    Good luck


  • WM_ACTIVATEAPP has the thread losing the focus id in its LPARAM, so you might forget the timer and do something like this:


    case WM_ACTIVATEAPP:

    AttachThreadInput(GetCurrentThreadId(), lParam, (BOOL) wParam );

    return( 0 );


    case WM_SETFOCUS:

    SetFocus((HWND)wParam);

    keybd_event(....);

    return( 0 );


    Havent tried this but might actually work!


Sign In or Register to comment.