Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Подмена "штатного" сетевого окружения при возврате с хоста 
Author Message
HankHank



PostPosted: Tue Apr 20, 2010 21:43    Post subject: Reply with quote

Хочется задействовать командную строку в плагине. Минимальными трудозатратами. Можно попытаться отдать строку Коммандеру, после чего умыть руки. А он уж её пускай обрабатывает.
На уровне идеи, без реализации, на примере клавиатурного хука выглядит как-то так:

Code:


DWORD __stdcall ExecEmulate(void)
{
   // focus to command line
   SendMessage(hMainWnd, WM_USER + 51, 4003, 0);
   // ENTER-pressing
   keybd_event(VK_RETURN, 0, KEYEVENTF_EXTENDEDKEY, 0);
   return 0;
}

bool ExecCommandLine()
{
   HANDLE thread=CreateThread(0, 0, ExecEmulate, 0, 0, 0);
   if (!thread) return 0;
   CloseHandle(thread);
   return 1;
}

LRESULT CALLBACK CallMouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
   if (wParam==WM_LBUTTONDBLCLK)
   {
      HWND mylb=GetActivePanel();
      POINT pt;
      GetCursorPos(&pt);
      ScreenToClient(mylb, &pt);
      int index=SendMessage(mylb, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); // get item index under cursor
      if (!index&&IsForbiddenLevelUp())
      { // it is ".." item and we should refuse 'level up'
         HWND cmdpanel, edit;
         if ((cmdpanel=FindWindowEx(hMainWnd, cmdpanel, "TMyPanel", "")))
            if ((edit=FindWindowEx(cmdpanel, edit, "TMyComboBox", "")))
               if ((FindWindowEx(edit, 0, "TMyComboBox", "")))
               {
                  char buf[1024];
                  int k=GetWindowText(edit, buf, TSIZE(buf));
                  
pseudo code: if buf not emty then
                     ExecCommandLine();

                  
                  return 1; // kill doubleclick event
               }


         DoMyAction();
         return 1; // kill doubleclick event
      }
   }
   return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}

Принял обтекаемую форму. Very Happy Вижу, что топорно.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group