本文整理汇总了C++中PluginStartupInfo::PanelControl方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginStartupInfo::PanelControl方法的具体用法?C++ PluginStartupInfo::PanelControl怎么用?C++ PluginStartupInfo::PanelControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginStartupInfo
的用法示例。
在下文中一共展示了PluginStartupInfo::PanelControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessSynchroEventW
intptr_t WINAPI ProcessSynchroEventW(const struct ProcessSynchroEventInfo *Info)
{
if (Info->Event != SE_COMMONSYNCHRO)
return 0;
if (gnInCall > 0)
return 0;
#if 1
OutputDebugString(L"Posting macro\n");
MacroSendMacroText mcr = {sizeof(MacroSendMacroText)};
//mcr.SequenceText = L"i = 0; if APanel.Plugin then i=i+1; end; if PPanel.Plugin then i=i+2; end; Plugin.Call(\"6197AF6C-4755-49A5-84A1-8F227BF4790E\",i)";
mcr.SequenceText = L"Plugin.Call(\"6197AF6C-4755-49A5-84A1-8F227BF4790E\",APanel.Plugin and \"\" or APanel.Path0,PPanel.Plugin and \"\" or PPanel.Path0)";
INT_PTR i = psi.MacroControl(&guid_PluginGuid, MCTL_SENDSTRING, MSSC_POST, &mcr);
MacroParseResult* mpr;
if (!i)
{
mpr = (MacroParseResult*)calloc(4096,1);
mpr->StructSize = sizeof(*mpr);
psi.MacroControl(&guid_PluginGuid, MCTL_GETLASTERROR, 4096, mpr);
free(mpr);
}
else
InterlockedIncrement(&gnInCall);
#endif
#if 0
wchar_t szDbg[100];
static LONG nCount; nCount++;
wsprintf(szDbg, L"%i: PanelControl(FCTL_GETPANELINFO, PANEL_ACTIVE)...", nCount);
PanelInfo piA = {sizeof(piA)}, piP = {sizeof(piP)};
INT_PTR nARc = psi.PanelControl(PANEL_ACTIVE, FCTL_GETPANELINFO, 0, &piA);
OutputDebugString(L" and PANEL_PASSIVE...");
INT_PTR nPRc = psi.PanelControl(PANEL_PASSIVE, FCTL_GETPANELINFO, 0, &piP);
OutputDebugString(L" Done\n");
#endif
return 0;
}
示例2: OpenW
HANDLE WINAPI OpenW(const OpenInfo* info)
{
if (!info || info->StructSize < sizeof(OpenInfo))
return nullptr;
//Determine file name to analyze
wstring file_name;
if (info->OpenFrom == OPEN_COMMANDLINE && info->Data) {
const OpenCommandLineInfo* ocli = reinterpret_cast<const OpenCommandLineInfo*>(info->Data);
if (!ocli || ocli->StructSize < sizeof(OpenCommandLineInfo) || !ocli->CommandLine || !ocli->CommandLine[0])
return nullptr;
//Get command line
wstring cmd_line = ocli->CommandLine;
size_t pos = 0;
while ((pos = cmd_line.find(L'\"', pos)) != string::npos)
cmd_line.erase(pos, 1);
while (!cmd_line.empty() && iswspace(cmd_line[0]))
cmd_line.erase(0, 1);
while (!cmd_line.empty() && iswspace(cmd_line[cmd_line.length() - 1]))
cmd_line.erase(cmd_line.length() - 1, 1);
if (cmd_line.empty())
return nullptr;
//Expand environment variables in path string
wstring exp_path(2048, 0);
if (ExpandEnvironmentStrings(cmd_line.c_str(), &exp_path.front(), static_cast<DWORD>(exp_path.size() - 1)))
exp_path.resize(lstrlen(exp_path.c_str()));
else
exp_path = cmd_line;
const size_t path_len = _FSF.ConvertPath(CPM_FULL, exp_path.c_str(), nullptr, 0);
if (path_len) {
file_name.resize(path_len);
_FSF.ConvertPath(CPM_FULL, exp_path.c_str(), &file_name[0], path_len);
}
}
else if (info->OpenFrom == OPEN_PLUGINSMENU) {
PanelInfo pi;
ZeroMemory(&pi, sizeof(pi));
pi.StructSize = sizeof(pi);
if (!_PSI.PanelControl(PANEL_ACTIVE, FCTL_GETPANELINFO, 0, &pi))
return nullptr;
const intptr_t ppi_len = _PSI.PanelControl(PANEL_ACTIVE, FCTL_GETPANELITEM, static_cast<int>(pi.CurrentItem), nullptr);
if (ppi_len == 0)
return nullptr;
vector<unsigned char> buffer(ppi_len);
PluginPanelItem* ppi = reinterpret_cast<PluginPanelItem*>(&buffer.front());
FarGetPluginPanelItem fgppi;
ZeroMemory(&fgppi, sizeof(fgppi));
fgppi.StructSize = sizeof(fgppi);
fgppi.Size = buffer.size();
fgppi.Item = ppi;
if (!_PSI.PanelControl(PANEL_ACTIVE, FCTL_GETPANELITEM, static_cast<int>(pi.CurrentItem), &fgppi))
return nullptr;
const size_t file_name_len = _FSF.ConvertPath(CPM_FULL, ppi->FileName, nullptr, 0);
if (file_name_len) {
file_name.resize(file_name_len);
_FSF.ConvertPath(CPM_FULL, ppi->FileName, &file_name[0], file_name_len);
}
}
if (!file_name.empty()) {
unlocker u;
u.process(file_name.c_str());
}
return nullptr;
}
示例3: OpenW
HANDLE WINAPI OpenW(const struct OpenInfo *Info)
{
const int CUR_DIR_SIZE = 100000;
char* filename = 0;
switch( Info->OpenFrom )
{
case OPEN_COMMANDLINE:
{
OpenCommandLineInfo* cinfo = (OpenCommandLineInfo*)Info->Data;
const wchar_t* cmdline = cinfo->CommandLine;
if( !cmdline )
return INVALID_HANDLE_VALUE;
while( *cmdline && *cmdline <= ' ' )
cmdline++;
if( *cmdline )
filename = w2a( cmdline );
else
return 0;
break;
}
case OPEN_PLUGINSMENU:
{
FarGetPluginPanelItem pinfo;
PluginPanelItem* pitem = (PluginPanelItem*)malloc(CUR_DIR_SIZE);
ZeroMemory(&pinfo, sizeof(pinfo));
ZeroMemory(pitem, CUR_DIR_SIZE);
pinfo.StructSize = sizeof(pinfo);
pinfo.Size = CUR_DIR_SIZE;
pinfo.Item = pitem;
if(InfoW.PanelControl( PANEL_ACTIVE, FCTL_GETCURRENTPANELITEM, 0, &pinfo ))
{
filename = w2a( pinfo.Item->FileName );
free(pitem);
}
else
{
free(pitem);
return 0;
}
break;
}
default:
return 0;
}
if( !filename )
return 0;
wchar_t comspec[MAX_PATH * 2];
if( !GetEnvironmentVariableW( L"COMSPEC", comspec, sizeofa( comspec ) ) )
lstrcpyW( comspec, L"cmd.exe" );
char pipename[100];
wsprintf( pipename, "\\\\.\\pipe\\FarCall%ul", GetCurrentProcessId() );
char* batchstr = (char*)malloc( 10000 );
wsprintf( batchstr, batch, filename, ModuleName, pipename );
// obtaining temp file name
wchar_t tmp[MAX_PATH * 10];
GetTempPathW( sizeofa( tmp ), tmp );
GetTempFileNameW( tmp, L"", 0, tmp );
DeleteFileW( tmp );
lstrcatW( tmp, L".bat" );
HANDLE file = CreateFileW( tmp, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0 );
if( !file || file == INVALID_HANDLE_VALUE )
{
DeleteFileW( tmp );
free( filename );
free( batchstr );
return INVALID_HANDLE_VALUE;
}
DWORD written;
WriteFile( file, batchstr, lstrlen( batchstr ), &written, 0 );
CloseHandle( file );
wchar_t cmd[MAX_PATH * 10] = L"\"";
lstrcatW( lstrcatW( lstrcatW( lstrcatW( cmd, comspec ), L"\" /c \"" ), tmp ), L"\"");
STARTUPINFOW sinfo;
ZeroMemory( &sinfo, sizeof( sinfo ) );
sinfo.cb = sizeof( sinfo );
PROCESS_INFORMATION pinfo;
Handle np( CreateNamedPipe( pipename, PIPE_ACCESS_DUPLEX, PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 100, 100, 0, 0 ) );
connected = false;
DWORD id;
Handle thread( CreateThread( 0, 0, ListenEnv, np, 0, &id ) );
//.........这里部分代码省略.........