1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? 2 GUI questions and return HWND using TakeCommandIPC

Discussion in 'Support' started by ehab aboudaya, Mar 9, 2012.

  1. ehab aboudaya

    Joined:
    Mar 9, 2012
    Messages:
    22
    Likes Received:
    0
    hi

    i have been trying to figure out:

    1- is there a global hot key to restore tcmd from tray?
    2- is there a shortcut key to switch between current tab and the command input? note: not using ctrl-tab and arrowkeys to select the command input window!

    if there is no solution then 2 it can be done using a plugin.

    Can anyone provide code sample using TakeCommandIPC to get handle of tcmd and i can use

    Code:
    FoundWindow = FindWindowEx(tcmdHandle, 0, 'Scintilla ', nil);
     
    PostMessage( FoundWindow , WM_NEXTDLGCTL, 0, 0L) ;

    to set focus

    with my regards and thanks
    ehab

    Take Command v13.03.48
     
  2. ehab aboudaya

    Joined:
    Mar 9, 2012
    Messages:
    22
    Likes Received:
    0
    i spent couple of hours finding answers.

    for those interested:

    1- use Autohotkey
    Code:
    ^!n::Run TCMD
    ^!c::Run "C:\Program Files\JPSoft\TCMD13\tcmd.exe"
    2- use the sdk sample and in
    Code:
    DLLExports INT WINAPI key( LPKEYINFO ki )
    {
        switch ( ki->nKey )
            {
                case CTL_HOME : // change to your own binding
                    AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(),NULL),    GetCurrentThreadId(),TRUE);
                    HWND inWindowHandle = FindWindowEx(GetForegroundWindow(),NULL,_T("XTPDockingPaneTabbedContainer"), NULL);
                    HWND top_child = GetWindow(inWindowHandle, GW_CHILD);
                    SetForegroundWindow(top_child);
                    SetFocus(top_child);
                    AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(),NULL),GetCurrentThreadId(),FALSE);
                    ki->nKey = 0;
                  break;
            }
        return 0;
    }
    
    there is always another way, i hope this helps those need to switch to Command Input quickly and maybe the developers will add such a feature in future.

    regards
    ehab
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    #1 - No.

    #2 - There is no shortcut key to take you straight to the command input window, though Alt-F6 will toggle between command input, folder view, list view, and tab window. Nobody's ever requested it, and since you would have had to either use the mouse or the ctrl-tab dialog to switch away from the command input window it didn't seem unreasonable to expect you to switch back the same way.)

    This is how it's called in TCC:

    Code:
    // returns the TCMD window handle if we're running in a TCMD tab window
    HWND QueryParentWindow( void )
    {
      TCHAR szBuffer[128];
     
      szBuffer[0] = _TEXT('\0');
    if ( TakeCommandIPC( L"hwnd", szBuffer ) != -1 ) {
    #if _WIN == 64
      return (HWND)_wtoi64( szBuffer );
    #else
      return (HWND)_wtoi( szBuffer );
    #endif
    }
    }
    
     
  4. ehab aboudaya

    Joined:
    Mar 9, 2012
    Messages:
    22
    Likes Received:
    0
    Thanks Rex

    i will add my request for global hot key and key to switch between current tab and command input.

    appreciated the example.

    Alt-F6 should honor hidden controls.
     

Share This Page