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


C++ Edit_SetSel函数代码示例

本文整理汇总了C++中Edit_SetSel函数的典型用法代码示例。如果您正苦于以下问题:C++ Edit_SetSel函数的具体用法?C++ Edit_SetSel怎么用?C++ Edit_SetSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wlog

void wlog(const char* buffer){
		char* buf;
	    int hloglen=GetWindowTextLength(hlog)+1;
	    int slen=strlen(buffer)+1;
		if(slen<30000){
		        buf= new char[2];//hloglen+slen+1];
		        buf = (char*)Mrealloc(buf,hloglen+slen+1);
				memset(buf,0,hloglen+slen+1);
				if((hloglen+slen)<30000)GetWindowText(hlog,buf,hloglen);
				else{
					char* tmpbuf=new char[2];tmpbuf = (char*)Mrealloc(tmpbuf,hloglen+1);GetWindowText(hlog,&tmpbuf[0],hloglen);
					//int oldsize;oldsize=sizeof(globallog);
					globallog = (char*)Mrealloc(globallog,hloglen+globallogsize+1);
					memcpy(&globallog[globallogsize],tmpbuf,hloglen-1);globallogsize+=hloglen;
				}
				lstrcat(buf,buffer);
				SetWindowText(hlog, buf);
				Edit_Scroll(hlog,Edit_GetLineCount(hlog),0);
				int wlen=GetWindowTextLength(hlog);
				Edit_SetSel(hlog,wlen-1,wlen);
				Edit_SetSel(hlog,wlen,wlen);
				SetFocus(hlog);
				ShowCaret(hlog);
				delete[] buf;
		}
}
开发者ID:aehaynes,项目名称:otskok-impuls,代码行数:26,代码来源:main.cpp

示例2: writeScreen

static void
writeScreen(const char *msg, uint len)
{
    if (MainWindow == 0)
        return;

    wchar_t buff[MAXOUTBUF];
    mbstowcs(buff, msg, ARRAY_SIZE(buff));

    HWND hConsole = GetDlgItem(MainWindow, ID_LOG);
    uint maxlen = SendMessage(hConsole, EM_GETLIMITTEXT, 0, 0);

    if (len >= maxlen)
        // Message wont fit on screen.
        return;

    // Remove lines until there is space in screen log
    uint tl;
    for (;;) {
        tl = GetWindowTextLength(hConsole);
        if (tl + len < maxlen)
            break;
        uint linelen = SendMessage(hConsole, EM_LINELENGTH, 0, 0) + 2;
        Edit_SetSel(hConsole, 0, linelen);
        Edit_ReplaceSel(hConsole, "");
    }

    // Paste message to screen log
    Edit_SetSel(hConsole, tl, tl);
    Edit_ReplaceSel(hConsole, buff);
}
开发者ID:jessenic,项目名称:HaRET-WP7,代码行数:31,代码来源:output.cpp

示例3: SendMailInitialize

/*
 * SendMailInitialize:  Initialize dialog to reflect settings in "reply" variable.
 */
void SendMailInitialize(HWND hDlg, MailInfo *reply)
{
   HWND hRecipients;
   int i;

   /* Set recipients, separated by commas in list box */
   hRecipients = GetDlgItem(hDlg, IDC_RECIPIENTS);
   WindowBeginUpdate(hRecipients);
   for (i=0; i < reply->num_recipients; i++)
   {
      if (i != 0)
      {
	 Edit_SetSel(hRecipients, -1, -1);
	 Edit_ReplaceSel(hRecipients, ", ");
      }
      Edit_SetSel(hRecipients, -1, -1);
      Edit_ReplaceSel(hRecipients, reply->recipients[i]);
   }
   WindowEndUpdate(hRecipients);

   /* Set subject */
   SetDlgItemText(hDlg, IDC_SUBJECT, reply->subject);

   // Free memory for reply info
   SafeFree(reply);
}
开发者ID:Tatsujinichi,项目名称:Meridian59,代码行数:29,代码来源:mailsend.c

示例4: editInsertTextAtLast

// insert text at last
void editInsertTextAtLast(HWND i_hwnd, const tstring &i_text,
                          size_t i_threshold)
{
    if (i_text.empty())
        return;

    size_t len = editGetTextBytes(i_hwnd);

    if (i_threshold < len) {
        Edit_SetSel(i_hwnd, 0, len / 3 * 2);
        Edit_ReplaceSel(i_hwnd, _T(""));
        editDeleteLine(i_hwnd, 0);
        len = editGetTextBytes(i_hwnd);
    }

    Edit_SetSel(i_hwnd, len, len);

    // \n -> \r\n
    Array<_TCHAR> buf(i_text.size() * 2 + 1);
    _TCHAR *d = buf.get();
    const _TCHAR *str = i_text.c_str();
    for (const _TCHAR *s = str; s < str + i_text.size(); ++ s) {
        if (*s == _T('\n'))
            *d++ = _T('\r');
        *d++ = *s;
    }
    *d = _T('\0');

    Edit_ReplaceSel(i_hwnd, buf.get());
}
开发者ID:byplayer,项目名称:yamy,代码行数:31,代码来源:windowstool.cpp

示例5: CPathEditWnd

void CPathEditUI::ShowEditWnd()
{
	if (m_pWindow == NULL)
	{
		m_pWindow = new CPathEditWnd();
		ASSERT(m_pWindow);
		m_pWindow->Init(this);

		TCHAR text[MAX_PATH] = {0};
		GetWindowText(m_pWindow->GetHWND(), text, MAX_PATH);

		LPTSTR lpt = StrRChr(text, NULL, _T('.'));

		if (lpt != NULL)
		{
			int nSize = lpt - text;
			Edit_SetSel(*m_pWindow, 0, nSize);
		}
		else
		{
			int nSize = GetWindowTextLength(*m_pWindow);
			if( nSize == 0 )
				nSize = 1;

			Edit_SetSel(*m_pWindow, 0, nSize);		
		}
	}
}
开发者ID:hdwdsj,项目名称:MyManager,代码行数:28,代码来源:PathEditUI.cpp

示例6: _uprintf

void _uprintf(const char *format, ...)
{
    char buf[4096], *p = buf;
    va_list args;
    int n;

    va_start(args, format);
    n = safe_vsnprintf(p, sizeof(buf)-3, format, args); // buf-3 is room for CR/LF/NUL
    va_end(args);

    p += (n < 0)?sizeof(buf)-3:n;

    while((p>buf) && (isspace((unsigned char)p[-1])))
        *--p = '\0';

    *p++ = '\r';
    *p++ = '\n';
    *p   = '\0';

    // Send output to Windows debug facility
    OutputDebugStringA(buf);
    // Send output to our log Window
    Edit_SetSel(hLog, MAX_LOG_SIZE, MAX_LOG_SIZE);
    Edit_ReplaceSelU(hLog, buf);
    // Make sure the message scrolls into view
    // (Or see code commented in LogProc:WM_SHOWWINDOW for a less forceful scroll)
    SendMessage(hLog, EM_LINESCROLL, 0, SendMessage(hLog, EM_GETLINECOUNT, 0, 0));
}
开发者ID:ngocphu811,项目名称:rufus,代码行数:28,代码来源:stdio.c

示例7: DirectXDialogProc

INT_PTR CALLBACK DirectXDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	HWND hEdit;

	const char *directx_help =
		MAMEUINAME " requires DirectX version 3 or later, which is a set of operating\r\n"
		"system extensions by Microsoft for Windows 9x, NT and 2000.\r\n\r\n"
		"Visit Microsoft's DirectX web page at http://www.microsoft.com/directx\r\n"
		"download DirectX, install it, and then run " MAMEUINAME " again.\r\n";

	switch (Msg)
	{
	case WM_INITDIALOG:
		hEdit = GetDlgItem(hDlg, IDC_DIRECTX_HELP);
		Edit_SetSel(hEdit, Edit_GetTextLength(hEdit), Edit_GetTextLength(hEdit));
		Edit_ReplaceSel(hEdit, directx_help);
		return 1;

	case WM_COMMAND:
		if (LOWORD(wParam) == IDB_WEB_PAGE)
			ShellExecute(GetMainWindow(), NULL, TEXT("http://www.microsoft.com/directx"),
						 NULL, NULL, SW_SHOWNORMAL);

		if (LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDB_WEB_PAGE)
			EndDialog(hDlg, 0);
		return 1;
	}
	return 0;
}
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:29,代码来源:dialogs.c

示例8: appendMsg

// Append a message to the result display.
static void appendMsg(HWND win, const char *msg) {
	char *newMsg;
	long len;

	// There's no easy way to append text to a text box. We'll insert an
	// extra character (a newline) each time text is added. When text is
	// added later, we'll select the extra character and replace the selection
	// with the new text.

	// Add a newline to the message.
	newMsg = (char *)malloc(strlen(msg) + 2 + 1);
	if (NULL == newMsg) {
		return;
	}
	strcpy(newMsg, msg);
	strcat(newMsg, "\r\n");

	len = Edit_GetTextLength(GetDlgItem(win, IDC_RESULT_EDT));
	if (len > 0) {
		// Select the last character.
		Edit_SetSel(GetDlgItem(win, IDC_RESULT_EDT), len, len);

		// Replace the selection with the new message.
		Edit_ReplaceSel(GetDlgItem(win, IDC_RESULT_EDT), newMsg);
	}
	else {
		// Just add the message.
		Edit_SetText(GetDlgItem(win, IDC_RESULT_EDT), newMsg);
	}
	free(newMsg);
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:32,代码来源:sscedemo.c

示例9: SavePlaylistDlgProc

BOOL CALLBACK SavePlaylistDlgProc(HWND hwnd, 
                                  UINT msg, 
                                  WPARAM wParam, 
                                  LPARAM lParam )
{
    BOOL result = FALSE;
    static char* szName = NULL;

    switch (msg)
    {
        case WM_INITDIALOG:
        {
            HWND hwndName = GetDlgItem(hwnd, IDC_NAME);

            szName = (char*)lParam;
            
            SetFocus(hwndName);
            Edit_SetText(hwndName, szName);
            Edit_SetSel(hwndName, 0, -1);

            SetProp(hwndName, 
                    "oldproc",
                    (HANDLE)GetWindowLong(hwndName, GWL_WNDPROC));

	        // Subclass the window so we can handle bad characters
	        SetWindowLong(hwndName, 
			              GWL_WNDPROC, 
                          (DWORD)::EditWndProc);  
            
            return FALSE;
            break;
        }      

        case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
                case IDCANCEL:
                    EndDialog(hwnd, FALSE);
                    break;

                case IDOK:
                {
                    HWND hwndName = GetDlgItem(hwnd, IDC_NAME);
                    
                    Edit_GetText(hwndName, 
                                 szName,
                                 MAX_PATH);

                    EndDialog(hwnd, TRUE);
                    break;
                }
            }
  
            break;
        }
    }

    return result;
}
开发者ID:pontocom,项目名称:opensdrm,代码行数:60,代码来源:SavePlaylistDialog.cpp

示例10: ExtendedEditWndProc

// selects all text in an edit box if it's selected either
// through a keyboard shortcut or a non-selecting mouse click
// (or responds to Ctrl+Backspace as nowadays expected)
bool ExtendedEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNUSED(lParam);

    static bool delayFocus = false;

    switch (message) {
    case WM_LBUTTONDOWN:
        delayFocus = GetFocus() != hwnd;
        return true;

    case WM_LBUTTONUP:
        if (delayFocus) {
            DWORD sel = Edit_GetSel(hwnd);
            if (LOWORD(sel) == HIWORD(sel))
                PostMessage(hwnd, UWM_DELAYED_SET_FOCUS, 0, 0);
            delayFocus = false;
        }
        return true;

    case WM_KILLFOCUS:
        return false; // for easier debugging (make setting a breakpoint possible)

    case WM_SETFOCUS:
        if (!delayFocus)
            PostMessage(hwnd, UWM_DELAYED_SET_FOCUS, 0, 0);
        return true;

    case UWM_DELAYED_SET_FOCUS:
        Edit_SelectAll(hwnd);
        return true;

    case WM_KEYDOWN:
        if (VK_BACK != wParam || !IsCtrlPressed() || IsShiftPressed())
            return false;
        PostMessage(hwnd, UWM_DELAYED_CTRL_BACK, 0, 0);
        return true;

    case UWM_DELAYED_CTRL_BACK:
        {
            ScopedMem<WCHAR> text(win::GetText(hwnd));
            int selStart = LOWORD(Edit_GetSel(hwnd)), selEnd = selStart;
            // remove the rectangle produced by Ctrl+Backspace
            if (selStart > 0 && text[selStart - 1] == '\x7F') {
                memmove(text + selStart - 1, text + selStart, str::Len(text + selStart - 1) * sizeof(WCHAR));
                win::SetText(hwnd, text);
                selStart = selEnd = selStart - 1;
            }
            // remove the previous word (and any spacing after it)
            for (; selStart > 0 && str::IsWs(text[selStart - 1]); selStart--);
            for (; selStart > 0 && !str::IsWs(text[selStart - 1]); selStart--);
            Edit_SetSel(hwnd, selStart, selEnd);
            SendMessage(hwnd, WM_CLEAR, 0, 0);
        }
        return true;

    default:
        return false;
    }
}
开发者ID:vipontes,项目名称:sumatrapdf,代码行数:63,代码来源:AppTools.cpp

示例11: InterfaceAdminInputProc

long CALLBACK InterfaceAdminInputProc(HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
	char buf[200];
	
	switch (message)
	{
	case WM_CHAR :
		if (wParam == '\r')
		{
			if (InMainLoop() && !GetQuit())
			{
				/* make sure we've started already, so that session id is valid */
				Edit_SetSel(hwnd,0,-1);
				Edit_GetText(hwnd,buf,sizeof buf);
				cprintf(console_session_id,"%s\n",buf);
				
				EnterServerLock();
				TryAdminCommand(console_session_id,buf);
				LeaveServerLock();
			}
			return 0;
		}
		if (wParam == '\t')
		{
			SetFocus(GetDlgItem(HWND_ADMIN,IDC_ADMIN_RESPONSE));
			return 0;      
		}
		
		
	}
	return CallWindowProc(lpfnDefAdminInputProc,hwnd,message,wParam,lParam);
}
开发者ID:Shaijan,项目名称:Meridian59,代码行数:32,代码来源:interface.c

示例12: DetailsPrintf

static void CLIB_DECL DetailsPrintf(const char *fmt, ...)
{
	HWND	hEdit;
	va_list marker;
	char	buffer[2000];
	char * s;
	long l;

	//RS 20030613 Different Ids for Property Page and Dialog
	// so see which one's currently instantiated
	hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS);
	if (hEdit ==  NULL)
		hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS_PROP);
	
	if (hEdit == NULL)
	{
		dprintf("audit detailsprintf() can't find any audit control");
		return;
	}

	va_start(marker, fmt);
	
	vsprintf(buffer, fmt, marker);
	
	va_end(marker);

	s = ConvertToWindowsNewlines(buffer);

	l = Edit_GetTextLength(hEdit);
	Edit_SetSel(hEdit, Edit_GetTextLength(hEdit), Edit_GetTextLength(hEdit));
	SendMessage( hEdit, EM_REPLACESEL, FALSE, (WPARAM)s );
}
开发者ID:cinnamoncoin,项目名称:historic-mess,代码行数:32,代码来源:audit32.c

示例13: OnButtonBrowse

static void OnButtonBrowse()
{
    ScopedMem<WCHAR> installDir(win::GetText(gHwndTextboxInstDir));
    // strip a trailing "\SumatraPDF" if that directory doesn't exist (yet)
    if (!dir::Exists(installDir))
        installDir.Set(path::GetDir(installDir));

    WCHAR path[MAX_PATH];
    BOOL ok = BrowseForFolder(gHwndFrame, installDir, _TR("Select the folder where SumatraPDF should be installed:"), path, dimof(path));
    if (!ok) {
        SetFocus(gHwndButtonBrowseDir);
        return;
    }

    WCHAR *installPath = path;
    // force paths that aren't entered manually to end in ...\SumatraPDF
    // to prevent unintended installations into e.g. %ProgramFiles% itself
    if (!str::EndsWithI(path, L"\\" APP_NAME_STR))
        installPath = path::Join(path, APP_NAME_STR);
    win::SetText(gHwndTextboxInstDir, installPath);
    Edit_SetSel(gHwndTextboxInstDir, 0, -1);
    SetFocus(gHwndTextboxInstDir);
    if (installPath != path)
        free(installPath);
}
开发者ID:Vindfs,项目名称:sumatrapdf,代码行数:25,代码来源:Install.cpp

示例14: Window_StopwatchExportDlg

static INT_PTR CALLBACK Window_StopwatchExportDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	(void)lParam; // unused
	switch(msg) {
	case WM_INITDIALOG:{
		wchar_t buf[128];
		api.GetStr(L"Timers", L"SwExT", buf, _countof(buf), L"");
		SetDlgItemText(hDlg,IDC_SWE_TOTAL,buf);
		api.GetStr(L"Timers", L"SwExL", buf, _countof(buf), L"");
		SetDlgItemText(hDlg, IDC_SWE_LAP, buf);
		SendMessage(hDlg, WM_COMMAND,IDOK, 0);
		Edit_SetSel(GetDlgItem(hDlg,IDC_SWE_OUT), 0, -1);
		SetFocus(GetDlgItem(hDlg,IDC_SWE_OUT));
		return FALSE;}
	case WM_DESTROY:{
		break;}
	case WM_COMMAND: {
			switch(LOWORD(wParam)) {
			case IDC_SWE_EXPORT:{
				wchar_t filename[MAX_PATH];
				unsigned buflen = (unsigned)SendDlgItemMessageA(hDlg,IDC_SWE_OUT,WM_GETTEXTLENGTH,0,0);
				char* buf = malloc(buflen + 1);
				if(buf && buflen){
					GetDlgItemTextA(hDlg, IDC_SWE_OUT, buf, buflen+1);
					*filename = '\0';
					if(SaveFileDialog(hDlg,filename,_countof(filename))){
						FILE* fp = _wfopen(filename, L"wb");
						if(fp){
							fwrite(buf, sizeof(buf[0]), buflen, fp);
							fclose(fp);
						}
					}
				}
				free(buf);
				break;}
			case IDOK:{
				wchar_t buf[128];
				GetDlgItemText(hDlg, IDC_SWE_TOTAL, buf, _countof(buf));
				if(!*buf){
					api.DelValue(L"Timers", L"SwExT");
					SetDlgItemText(hDlg, IDC_SWE_TOTAL, L"\\n--------------------\\n\\t");
				}else
					api.SetStr(L"Timers", L"SwExT", buf);
				GetDlgItemText(hDlg, IDC_SWE_LAP, buf, _countof(buf));
				if(!*buf){
					api.DelValue(L"Timers", L"SwExL");
					SetDlgItemText(hDlg, IDC_SWE_LAP, L"Lap \\#\\f: \\l (\\t)\\n");
				}else
					api.SetStr(L"Timers", L"SwExL", buf);
				export_text(hDlg);
				break;}
			case IDCANCEL:
				EndDialog(hDlg, TRUE);
			}
			return TRUE;
		}
	}
	return FALSE;
}
开发者ID:heicks,项目名称:T-Clock,代码行数:59,代码来源:StopWatch.c

示例15: append_output_window_real

static void append_output_window_real(const char *astring)
{
  int len;
  len=Edit_GetTextLength(logoutput_win);
  Edit_SetSel(logoutput_win,len,len);
  Edit_ReplaceSel(logoutput_win,astring);
  Edit_ScrollCaret(logoutput_win);
}
开发者ID:2085020,项目名称:freeciv-web,代码行数:8,代码来源:chatline.c


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