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 

Как заставить TC перечитать панель?

 
Post new topic   Reply to topic    Total Commander Forum Index -> Написание плагинов для Total Commander printer-friendly view
View previous topic :: View next topic  
Author Message
Alextp



Joined: 06 Feb 2005
Posts: 4957

Post (Separately) Posted: Sat Oct 08, 2005 19:20    Post subject: Как заставить TC перечитать панель? Reply with quote

Hello,

Написал FS-плагин. Проблема: хочу чтобы при выборе псевдо-файла "Перечитать панель" панель плагина перечитывалась. Как это организовать, в какой функции?
_________________
UniViewer - CudaText - LogViewer
Back to top
View user's profile Send private message
botace



Joined: 29 Sep 2005
Posts: 10
Location: Moscow

Post (Separately) Posted: Sat Oct 08, 2005 22:38    Post subject: Reply with quote

Пошли окну коммандера cm_RereadSource
Back to top
View user's profile Send private message
Alextp



Joined: 06 Feb 2005
Posts: 4957

Post (Separately) Posted: Sun Oct 09, 2005 00:19    Post subject: Reply with quote

2botace
А это будет работать, если запущено несколько копий коммандера?
Как из нескольких окон узнать окно с плагином?
_________________
UniViewer - CudaText - LogViewer
Back to top
View user's profile Send private message
botace



Joined: 29 Sep 2005
Posts: 10
Location: Moscow

Post (Separately) Posted: Sun Oct 09, 2005 01:00    Post subject: Reply with quote

Неа, в FsInit например сразу ищи для своего процесса:
Code:

struct EnumWindowsParam {
   DWORD   dwPID;
   HWND hFoundWnd;
};

BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM l)
{
   EnumWindowsParam* pParam = ( EnumWindowsParam*)l;
   DWORD dwPID = 0;
   ::GetWindowThreadProcessId( hWnd, &dwPID);
   if( pParam->dwPID == dwPID)
   {
      std::vector< char > vClass( 128, 0);
      if( ::GetClassName( hWnd, &vClass[ 0], (int)vClass.size()) && !stricmp( &vClass[ 0], "TTOTAL_CMD"))
      {
         pParam->hFoundWnd = hWnd;
         return FALSE;
      }
   }
   return TRUE;
}
...
...
EnumWindowsParam param = { GetCurrentProcessId(), NULL };
::EnumWindows( EnumWindowsProc, LPARAM( &param));
if( ::IsWindow( param.hFoundWnd))
{
    ...
}

Мона и более грубым и менее совместимым по виндам способом. Но, это если захочешь Smile
Back to top
View user's profile Send private message
Alextp



Joined: 06 Feb 2005
Posts: 4957

Post (Separately) Posted: Mon Oct 10, 2005 19:20    Post subject: Reply with quote

Догадался, как сделать проще всего. Handle окна передается плагину в FsExecuteFile (пар. MainWin), так что просто вызываем RereadPanel с этим хендлом:

Code:
procedure RereadPanel(hWnd: THandle);
const
  EM_DISPLAYBAND = WM_USER+51;
  cm_RereadSource = 540;
begin
  Sleep(200);
  SendMessage(hWnd, EM_DISPLAYBAND, cm_RereadSource, 0);
  Sleep(200);
end;


2botace
Спасибо за подсказку! Да, твой код на Дельфи:
Code:
type
  TEnumWindowsParam = record
    dwPID: DWORD;
    hFoundWnd: HWND;
  end;
  PEnumWindowsParam = ^TEnumWindowsParam;

function EnumWindowsProc(hWnd: THandle; l: LPARAM): BOOL; stdcall;
var
  pParam: PEnumWindowsParam;
  dwPID: DWORD;
  buf: array[0..200] of char;
begin
  pParam:= PEnumWindowsParam(l);
  dwPID:= 0;
  GetWindowThreadProcessId(hWnd, @dwPID);
  if pParam^.dwPID=dwPID then
   if (GetClassName(hWnd, buf, SizeOf(buf))>0) and (buf='TTOTAL_CMD') then
    begin
    pParam^.hFoundWnd:= hWnd;
    Result:= false;
    end;
  Result:= true;
end;

function GetTCHWnd: THandle;
var
  param: TEnumWindowsParam;
begin
  param.dwPID:= GetCurrentProcessId;
  param.hFoundWnd:= 0;
  EnumWindows(@EnumWindowsProc, LPARAM(@param));
  if IsWindow(param.hFoundWnd)
    then Result:= param.hFoundWnd else Result:= 0;
end;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Написание плагинов для Total Commander All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group