当前位置: 首页>>代码示例>>C++>>正文


C++ PluginStartupInfo::AdvControl方法代码示例

本文整理汇总了C++中PluginStartupInfo::AdvControl方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginStartupInfo::AdvControl方法的具体用法?C++ PluginStartupInfo::AdvControl怎么用?C++ PluginStartupInfo::AdvControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginStartupInfo的用法示例。


在下文中一共展示了PluginStartupInfo::AdvControl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PollingThread

DWORD WINAPI PollingThread(LPVOID lpThreadParameter)
{
	while (WaitForSingleObject(hExit, 100))
	{
		psi.AdvControl(&guid_PluginGuid, ACTL_SYNCHRO, 0, NULL);
	}
	return 0;
}
开发者ID:Maximus5,项目名称:FarPlugins,代码行数:8,代码来源:SyncPoll.cpp

示例2: ScrollText

static void ScrollText(ScrollType st)
{
	EditorInfo einfo = {sizeof(EditorInfo)};
	EditorSetPosition es = {sizeof(EditorSetPosition)};

	Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
	switch (st) {
	case stDn:
		es.CurLine = einfo.CurLine+1;
		break;
	case stUp:
		es.CurLine = einfo.CurLine-1;
		break;
	case stPgDn:
		es.CurLine = einfo.CurLine+einfo.WindowSizeY-1;
		es.TopScreenLine = einfo.TopScreenLine+einfo.WindowSizeY-1;
		break;
	case stPgUp:
		es.CurLine = einfo.CurLine-einfo.WindowSizeY+1;
		es.TopScreenLine = einfo.TopScreenLine-einfo.WindowSizeY+1;
		break;
	case stEnd:
		es.CurLine = /*es.TopScreenLine = */einfo.TotalLines-1;
		break;
	default:
		es.CurLine = /*es.TopScreenLine = */0;
		break;
	}
	bLineChanged = true;

	es.CurPos = -1;
	es.CurTabPos = es.LeftPos = es.Overtype = -1;
	Info.EditorControl(-1, ECTL_SETPOSITION, 0, &es);

	//обновим № исходной строки
	Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
	char *Lines = (char*)StackPeek();
	OriginalLine = CalcOriginalLine(einfo.CurLine);
	HighlightLine(einfo.CurLine);

	Info.AdvControl(&PluginId, ACTL_REDRAWALL, 0, NULL);
}
开发者ID:iyudincev,项目名称:FilterLines,代码行数:42,代码来源:FilterLines.cpp

示例3: if

static intptr_t WINAPI MyDlgProc(HANDLE hDlg, intptr_t Msg, intptr_t Param1, void *Param2)
{
	FarGetDialogItem DialogItem={sizeof(FarGetDialogItem)};
	const INPUT_RECORD* record;

	switch (Msg)
	{
	case DN_CONTROLINPUT:
		record=(const INPUT_RECORD *)Param2;
		if (record->EventType==KEY_EVENT &&
			record->Event.KeyEvent.bKeyDown &&
			record->Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED &&
			(record->Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED ||
			record->Event.KeyEvent.dwControlKeyState & RIGHT_CTRL_PRESSED))
		{
			switch (record->Event.KeyEvent.wVirtualKeyCode) {
			case VK_DOWN:
				ScrollText(stDn);
				return TRUE;
			case VK_UP:
				ScrollText(stUp);
				return TRUE;
			case VK_NEXT:
				ScrollText(stPgDn);
				return TRUE;
			case VK_PRIOR:
				ScrollText(stPgUp);
				return TRUE;
			case VK_END:
				ScrollText(stEnd);
				return TRUE;
			case VK_HOME:
				ScrollText(stHome);
				return TRUE;
			}
		}
		break;

	case DN_BTNCLICK:
		if (Param1==ixCaseSensitive) {
			bool bCaseSensitive = Param2!=0;
			if (bCaseSensitive!=bPrevCaseSensitive)
				UndoAll();
			bPrevCaseSensitive = bCaseSensitive;
		}
		Filter(PrevPattern, bPrevCaseSensitive);
		Info.AdvControl(&PluginId, ACTL_REDRAWALL, 0, NULL);
		break;

	case DN_EDITCHANGE:
		DialogItem.Size = (size_t)Info.SendDlgMessage(hDlg, DM_GETDLGITEM, ixSearchString, NULL);
		DialogItem.Item = (FarDialogItem*)malloc(DialogItem.Size);
		if (DialogItem.Item) {
			Info.SendDlgMessage(hDlg, DM_GETDLGITEM, ixSearchString, &DialogItem);
			size_t nChars = wcslen(DialogItem.Item->Data);
			size_t nPrevChars = Length(PrevPattern);
			bool bFilter = true;
			if (PrevPattern!=NULL) {
				//получается ли новая строка укорачиванием старой на символ
				if (bSequentialInput && nChars+1 == nPrevChars &&
					wcsncmp(DialogItem.Item->Data, PrevPattern, nChars) == 0)
				{
					//да - откатываем одну правку
					Undo();
					bFilter = false;
				}
				else
				{
					//получается ли новая строка добавлением символа к старой
					if (!(nChars == nPrevChars+1 &&
						wcsncmp(DialogItem.Item->Data, PrevPattern, nPrevChars) == 0))
					{
						//если нет - считаем, что откатывать по одной правке нельзя
						bSequentialInput = false;
					}
					//можно ли искать новую строку среди уже отфильтрованных
					if (wcsstr(DialogItem.Item->Data, PrevPattern) == NULL)
					{
						//нет - откатываем все правки
						UndoAll();
					}
				}
			}
			//выделить контекст заново при необходимости
			if (Length(PrevPattern)<MAX_PATTERN_LEN && nChars>=MAX_PATTERN_LEN) {
				SearchFree(ctx);
				ctx = SearchHAlloc();
			}
			else if (Length(PrevPattern)>=MAX_PATTERN_LEN && nChars<MAX_PATTERN_LEN) {
				SearchHFree(ctx);
				ctx = SearchAlloc();
			}

			//запомнить значение фильтра
			if (nChars!=0) {
				SetLength(&PrevPattern, (int)nChars);
				wcscpy(PrevPattern, DialogItem.Item->Data);
			}
			else {
				SetLength(&PrevPattern, 0);
//.........这里部分代码省略.........
开发者ID:iyudincev,项目名称:FilterLines,代码行数:101,代码来源:FilterLines.cpp

示例4: OpenW


//.........这里部分代码省略.........
    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 ) );
    
    while( !connected )
        Sleep( 100 );
    
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &csbi );
    
#ifndef LIGHTGRAY
#define LIGHTGRAY 7
#endif

    wchar_t Blank[1024];
    FSFW.sprintf(Blank,L"%*s",csbi.dwSize.X,L"");
    FarColor fc = {FCF_NONE, LIGHTGRAY, 0, 0};
    for (int Y=0;Y<csbi.dwSize.Y;Y++)
        InfoW.Text(0,Y,&fc,Blank);
    InfoW.Text(0,0,0,NULL);
    
    COORD C;
    C.X=0;
    C.Y=csbi.dwCursorPosition.Y;
    SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), C );

    wchar_t* curr_dir = (wchar_t*)malloc(CUR_DIR_SIZE);
    
    FSFW.GetCurrentDirectory(CUR_DIR_SIZE, curr_dir);

    if( np && CreateProcessW( NULL, cmd, 0, 0, TRUE, 0, 0, curr_dir[0] ? curr_dir : 0, &sinfo, &pinfo ) )
    {

        HANDLE ar[] = {pinfo.hProcess, np};

        WaitForMultipleObjects( 2, ar, TRUE, INFINITE );
        CloseHandle(pinfo.hProcess);
        CloseHandle(pinfo.hThread);
        SMALL_RECT src;
        COORD dest;
        CHAR_INFO fill;
        src.Left=0;
        src.Top=2;
        src.Right=csbi.dwSize.X;
        src.Bottom=csbi.dwSize.Y;
        dest.X=dest.Y=0;
        fill.Char.AsciiChar=' ';
        fill.Attributes=7;
        ScrollConsoleScreenBuffer( GetStdHandle( STD_OUTPUT_HANDLE ), &src, NULL, dest, &fill);

        InfoW.AdvControl(0, ACTL_REDRAWALL, 0, 0);
    }
    else
        Handle onp( CreateFile( pipename, GENERIC_WRITE,
            FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0 ) );

    
    free( filename );
    free( batchstr );
    free( curr_dir );
    DeleteFileW( tmp );
    
    return 0;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:101,代码来源:FarCall.cpp


注:本文中的PluginStartupInfo::AdvControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。