• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetWindowTextLengthW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sqlQueryCallback

	int sqlQueryCallback(void *arg, int argc, char **argv, char **azColName)
	{
		HWND hRes = static_cast<HWND>(arg);
		
		std::ostringstream ss;
		int len = GetWindowTextLengthW(hRes);
		if(len < 4096)
		{
			if(len > 0)
			{
				wchar_t* prev = new wchar_t[len+2];
				GetWindowTextW(hRes, prev, len+1);
				utfstring wPrev(prev);
				delete [] prev;
				ss << wPrev.toUTF8() << "\r\n";
			}
		}
		else
			return SQLITE_TOOBIG;

		for(int i=0; i<argc; i++)
		{
			if(azColName[i])
				ss << azColName[i] << ": " << argv[i] << "\r\n";
		}

		utfstring ws(ss.str().c_str());
		SetWindowText(hRes, ws.toUTF16());

		return SQLITE_OK;
	}
开发者ID:mmuszkow,项目名称:archStatusLog,代码行数:31,代码来源:SqlCmdWnd.cpp


示例2: CreateInstOnProc

static INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    HWND hEdit;

    switch(uMsg)
    {
        case WM_COMMAND:
            switch(LOWORD(wParam)) {
            case IDOK:
                memset(globals.wszMachineName, 0, sizeof(WCHAR[MAX_LOAD_STRING]));
                hEdit = GetDlgItem(hDlgWnd, IDC_MACHINE);

                if (GetWindowTextLengthW(hEdit)>0)
                    GetWindowTextW(hEdit, globals.wszMachineName, MAX_LOAD_STRING);

                EndDialog(hDlgWnd, IDOK);
                return TRUE;
            case IDCANCEL:
                EndDialog(hDlgWnd, IDCANCEL);
                return TRUE;
            }
    }

    return FALSE;
}
开发者ID:Sunmonds,项目名称:wine,代码行数:25,代码来源:oleview.c


示例3: starlog_log

static void
starlog_log(Starlog *s)
{
	const size_t MAX_BYTES = 1024;
	unsigned short *log = NULL;
	DWORD textlen, loglen;
	SYSTEMTIME t;

	GetLocalTime(&t);
	textlen = GetWindowTextLengthW(s->edit_log);
	if(!textlen) {
		return;
	}
	log = HeapAlloc(GetProcessHeap(), 0, sizeof(char)*MAX_BYTES);
	loglen = wsprintfW(log, L"~~~ %02d.%02d.%04d %02d:%02d:%02d ~~~\r\n",
		t.wDay, t.wMonth, t.wYear, t.wHour, t.wMinute, t.wSecond);
	loglen += GetWindowTextW(s->edit_log, &log[loglen],
		sizeof(short)*(MAX_BYTES-loglen));
	log[loglen] = '\r';
	log[loglen+1] = '\n';
	log[loglen+2] = 0;
	if(loglen) {
		HANDLE fd = CreateFile(".\\star.log",
			FILE_APPEND_DATA, FILE_SHARE_READ,
			NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
		if(fd==INVALID_HANDLE_VALUE) {
			return;
		}
		DWORD n = lstrlenW(log);
		WriteFile(fd, log, n*sizeof(short), &n, 0);
		CloseHandle(fd);
	}
	HeapFree(GetProcessHeap(), 0, log);
}
开发者ID:henkman,项目名称:starlog,代码行数:34,代码来源:starlog.c


示例4: DIALOG_EditWrap

VOID DIALOG_EditWrap(VOID)
{
    BOOL modify = FALSE;
    static const WCHAR editW[] = { 'e','d','i','t',0 };
    DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL |
                    ES_AUTOVSCROLL | ES_MULTILINE;
    RECT rc;
    DWORD size;
    LPWSTR pTemp;

    size = GetWindowTextLengthW(Globals.hEdit) + 1;
    pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
    if (!pTemp)
    {
        ShowLastError();
        return;
    }
    GetWindowTextW(Globals.hEdit, pTemp, size);
    modify = SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0);
    DestroyWindow(Globals.hEdit);
    GetClientRect(Globals.hMainWnd, &rc);
    if( Globals.bWrapLongLines ) dwStyle |= WS_HSCROLL | ES_AUTOHSCROLL;
    Globals.hEdit = CreateWindowExW(WS_EX_CLIENTEDGE, editW, NULL, dwStyle,
                         0, 0, rc.right, rc.bottom, Globals.hMainWnd,
                         NULL, Globals.hInstance, NULL);
    SendMessageW(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
    SetWindowTextW(Globals.hEdit, pTemp);
    SendMessageW(Globals.hEdit, EM_SETMODIFY, modify, 0);
    SetFocus(Globals.hEdit);
    HeapFree(GetProcessHeap(), 0, pTemp);
    
    Globals.bWrapLongLines = !Globals.bWrapLongLines;
    CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP,
        MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
}
开发者ID:AlexSteel,项目名称:wine,代码行数:35,代码来源:dialog.c


示例5: DoCloseFile

/**
 * Returns:
 *   TRUE  - User agreed to close (both save/don't save)
 *   FALSE - User cancelled close by selecting "Cancel"
 */
BOOL DoCloseFile(void)
{
    int nResult;
    static const WCHAR empty_strW[] = { 0 };

    nResult=GetWindowTextLengthW(Globals.hEdit);
    if (SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0) &&
        (nResult || Globals.szFileName[0]))
    {
        /* prompt user to save changes */
        nResult = AlertFileNotSaved(Globals.szFileName);
        switch (nResult) {
            case IDYES:     return DIALOG_FileSave();

            case IDNO:      break;

            case IDCANCEL:  return(FALSE);

            default:        return(FALSE);
        } /* switch */
    } /* if */

    SetFileNameAndEncoding(empty_strW, ENCODING_ANSI);

    UpdateWindowCaption();
    return(TRUE);
}
开发者ID:AlexSteel,项目名称:wine,代码行数:32,代码来源:dialog.c


示例6: SendMessage

void NFOView::CopySelectedText(void)
{
    DWORD selStart;
    DWORD selEnd;
    SendMessage(_handle, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd);

    if (selEnd > selStart)
    {
        int textLength = GetWindowTextLengthW(_handle);
        if (textLength > 0)
        {
            HGLOBAL selTextHandle;
            selTextHandle = GlobalAlloc(GHND, sizeof(wchar_t)*(selEnd - selStart + 1));

            // copy selected text to memory
            wchar_t* selText = (wchar_t*)GlobalLock(selTextHandle);
            memcpy(selText, _nfoText.c_str()+selStart, (selEnd-selStart)*sizeof(wchar_t));
            GlobalUnlock(selTextHandle);

            // copy to clipboard
            if (!OpenClipboard(_handle))
            { 
                return;
            }
            EmptyClipboard();
            SetClipboardData(CF_UNICODETEXT, selTextHandle);
            CloseClipboard();
        }
    }
    
    // deselect text after copy
    SendMessage(_handle, EM_SETSEL, (WPARAM)-1, (LPARAM)0);
}
开发者ID:wowh,项目名称:SimpleNfoViewer,代码行数:33,代码来源:NFOView.cpp


示例7: GetStringFromDialog

static LPWSTR
GetStringFromDialog(PCREATE_DATA Data,
                    UINT id)
{
    HWND hwnd;
    LPWSTR lpString = NULL;
    INT iLen = 0;

    hwnd = GetDlgItem(Data->hSelf,
                      id);
    if (hwnd)
    {
        iLen = GetWindowTextLengthW(hwnd);
        if (iLen)
        {
            lpString = (LPWSTR)HeapAlloc(ProcessHeap,
                                         0,
                                         (iLen + 1) * sizeof(WCHAR));
            if (lpString)
            {
                GetWindowTextW(hwnd,
                               lpString,
                               iLen + 1);
            }
        }
    }

    return lpString;
}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:29,代码来源:create.c


示例8: GetWindowTextUTF8

int GetWindowTextUTF8(HWND hWnd, LPTSTR lpString, int nMaxCount)
{
  if (!lpString) return 0;
  if (nMaxCount>0 AND_IS_NOT_WIN9X)
  {
    int alloc_size=nMaxCount;

    // prevent large values of nMaxCount from allocating memory unless the underlying text is big too
    if (alloc_size > 512)  
    {
      int l=GetWindowTextLengthW(hWnd);
      if (l>=0 && l < 512) alloc_size=1000;
    }

    {
      WIDETOMB_ALLOC(wbuf, alloc_size);
      if (wbuf)
      {
        GetWindowTextW(hWnd,wbuf,(int) (wbuf_size/sizeof(WCHAR)));

        if (!WideCharToMultiByte(CP_UTF8,0,wbuf,-1,lpString,nMaxCount,NULL,NULL) && GetLastError()==ERROR_INSUFFICIENT_BUFFER)
          lpString[nMaxCount-1]=0;

        WIDETOMB_FREE(wbuf);

        return (int)strlen(lpString);
      }
    }
  }
  return GetWindowTextA(hWnd,lpString,nMaxCount);
}
开发者ID:Artogn,项目名称:licecap,代码行数:31,代码来源:win32_utf8.c


示例9: win_copy_title

void
win_copy_title(void)
{
  int len = GetWindowTextLengthW(wnd);
  wchar title[len + 1];
  len = GetWindowTextW(wnd, title, len + 1);
  win_copy(title, 0, len + 1);
}
开发者ID:jdmansour,项目名称:mintty,代码行数:8,代码来源:winmain.c


示例10: GetWindowTextLengthW

        String Win32Window::GetTitle()
        {
            int l = GetWindowTextLengthW(hWnd);
            if (l == 0) return String();

            Utf16String titleW = Utf16String::Create(l);
            l = GetWindowText(hWnd, titleW.Ptr(), l);

            return Unicode::Utf16To8(titleW);
        }
开发者ID:drakh,项目名称:Xli,代码行数:10,代码来源:Win32Window.cpp


示例11: win_prefix_title

void
win_prefix_title(const char * prefix)
{
  int len = GetWindowTextLengthW(wnd);
  wchar ptitle[strlen(prefix) + len + 1];
  int plen = cs_mbstowcs(ptitle, prefix, lengthof(ptitle));
  wchar * title = & ptitle[plen];
  len = GetWindowTextW(wnd, title, len + 1);
  SetWindowTextW(wnd, ptitle);
}
开发者ID:jdmansour,项目名称:mintty,代码行数:10,代码来源:winmain.c


示例12: MyGetWindowText

void MyGetWindowText(ScriptValue &s, ScriptValue *args) {
	int len = GetWindowTextLengthW((HWND)args[0].intVal);
	if (len > 0) {
		len += 200;
		wchar_t *temp = (wchar_t*) malloc(sizeof(wchar_t) * len);
		int len2 = GetWindowTextW((HWND)args[0].intVal, temp, len);
		CreateStringValue(s, temp, len2);
		free(temp);
	}
}
开发者ID:ZmeyNet,项目名称:lcdmiscellany,代码行数:10,代码来源:ScriptWindowManagement.cpp


示例13: win_save_title

void
win_save_title(void)
{
  int len = GetWindowTextLengthW(wnd);
  wchar *title = newn(wchar, len + 1);
  GetWindowTextW(wnd, title, len + 1);
  delete(titles[titles_i]);
  titles[titles_i++] = title;
  if (titles_i == lengthof(titles))
    titles_i = 0;
}
开发者ID:jdmansour,项目名称:mintty,代码行数:11,代码来源:winmain.c


示例14: IPADDRESS_IsBlank

static BOOL IPADDRESS_IsBlank (IPADDRESS_INFO *infoPtr)
{
    int i;

    TRACE("\n");

    for (i = 0; i < 4; i++)
        if (GetWindowTextLengthW (infoPtr->Part[i].EditHwnd)) return FALSE;

    return TRUE;
}
开发者ID:howard5888,项目名称:wineT,代码行数:11,代码来源:ipaddress.c


示例15: SetLrgFont

static
HFONT
SetLrgFont(PMAP infoPtr)
{
    LOGFONTW lf;
    HFONT hFont = NULL;
    HDC hdc;
    HWND hCombo;
    LPWSTR lpFontName;
    INT Len;

    hCombo = GetDlgItem(infoPtr->hParent,
                        IDC_FONTCOMBO);

    Len = GetWindowTextLengthW(hCombo);

    if (Len != 0)
    {
        lpFontName = HeapAlloc(GetProcessHeap(),
                               0,
                               (Len + 1) * sizeof(WCHAR));

        if (lpFontName)
        {
            SendMessageW(hCombo,
                         WM_GETTEXT,
                         Len + 1,
                         (LPARAM)lpFontName);

            ZeroMemory(&lf,
                       sizeof(lf));

            hdc = GetDC(infoPtr->hLrgWnd);
            lf.lfHeight = GetDeviceCaps(hdc,
                                        LOGPIXELSY) / 2;
            ReleaseDC(infoPtr->hLrgWnd,
                      hdc);

            lf.lfCharSet =  DEFAULT_CHARSET;
            wcsncpy(lf.lfFaceName,
                    lpFontName,
                    sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));

            hFont = CreateFontIndirectW(&lf);

            HeapFree(GetProcessHeap(),
                     0,
                     lpFontName);
        }
    }

    return hFont;
}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:53,代码来源:lrgcell.c


示例16: GetWindowTextLengthW

NzString NzWindowImpl::GetTitle() const
{
	unsigned int titleSize = GetWindowTextLengthW(m_handle);
	if (titleSize == 0)
		return NzString();

	titleSize++; // Caractère nul

	std::unique_ptr<wchar_t[]> wTitle(new wchar_t[titleSize]);
	GetWindowTextW(m_handle, wTitle.get(), titleSize);

	return NzString::Unicode(wTitle.get());
}
开发者ID:GuillaumeBelz,项目名称:NazaraEngine,代码行数:13,代码来源:WindowImpl.cpp


示例17: GetWindowTextLengthW

String Window::getWindowText(HWND hWnd)
{
  int wsize = GetWindowTextLengthW(hWnd);
  wchar_t* buf = new wchar_t[wsize + 1];
  GetWindowTextW(hWnd, buf, wsize + 1);
  int size = WideCharToMultiByte(CP_UTF8, 0, buf, wsize, NULL, 0, NULL, NULL);
  String str;
  str.resize(size);
  WideCharToMultiByte(CP_UTF8, 0, buf, wsize, str.getBuffer(), size, NULL, NULL);
  str.setLength(size);
  delete[] buf;
  return str;
}
开发者ID:DylanGuedes,项目名称:dota-replay-manager,代码行数:13,代码来源:window.cpp


示例18: EnableOKButton

static void EnableOKButton(HWND hwnd){
	switch(m_DlgId){
		case DLG_LOGIN_MAIN:
			if(GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_MAIN)) > 0)
				EnableWindow(GetDlgItem(hwnd, IDOK), TRUE);
			else
				EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
			break;
		case DLG_LOGIN_CREATE:
			if(GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_MAIN)) > 0 && GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_SECOND)) > 0)
				EnableWindow(GetDlgItem(hwnd, IDOK), TRUE);
			else
				EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
			break;
		case DLG_LOGIN_CHANGE:
			if(GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_MAIN)) > 0 && GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_SECOND)) > 0 && GetWindowTextLengthW(GetDlgItem(hwnd, IDC_EDT_PWRD_NEW)) > 0)
				EnableWindow(GetDlgItem(hwnd, IDOK), TRUE);
			else
				EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
			break;
	}
}
开发者ID:lunakid,项目名称:PNotesz,代码行数:22,代码来源:login.c


示例19: GetWindowTextLengthW

std::string ZLWin32ApplicationWindow::TextEditParameter::internalValue() const {
	int len = GetWindowTextLengthW(myComboBox);
	if (len == 0) {
		return "";
	}
	static ZLUnicodeUtil::Ucs2String buffer;
	buffer.assign(len + 1, '\0');
	GetWindowTextW(myComboBox, (WCHAR*)::wchar(buffer), len + 1);
	buffer.pop_back();
	std::string text;
	ZLUnicodeUtil::ucs2ToUtf8(text, buffer);
	return text;
}
开发者ID:justsoso8,项目名称:fbreader,代码行数:13,代码来源:ZLWin32ApplicationWindow.cpp


示例20: AtlAxWin_wndproc

/**********************************************************************
 * AtlAxWin class window procedure
 */
static LRESULT CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
{
    if ( wMsg == WM_CREATE )
    {
            DWORD len = GetWindowTextLengthW( hWnd ) + 1;
            WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
            if (!ptr)
                return 1;
            GetWindowTextW( hWnd, ptr, len );
            AtlAxCreateControlEx( ptr, hWnd, NULL, NULL, NULL, NULL, NULL );
            HeapFree( GetProcessHeap(), 0, ptr );
            return 0;
    }
    return DefWindowProcW( hWnd, wMsg, wParam, lParam );
}
开发者ID:Fredz66,项目名称:wine,代码行数:18,代码来源:atl_ax.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetWindowTheme函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindowTextLength函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap