这篇教程C++ GetWindowTextLengthW函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetWindowTextLengthW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowTextLengthW函数的具体用法?C++ GetWindowTextLengthW怎么用?C++ GetWindowTextLengthW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetWindowTextLengthW函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例2: CreateInstOnProcstatic 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,
示例3: starlog_logstatic voidstarlog_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,
示例4: DIALOG_EditWrapVOID 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,
示例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,
示例6: SendMessagevoid 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,
示例7: GetStringFromDialogstatic LPWSTRGetStringFromDialog(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,
示例8: GetWindowTextUTF8int 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,
示例9: win_copy_titlevoidwin_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,
示例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,
示例11: win_prefix_titlevoidwin_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,
示例12: MyGetWindowTextvoid 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,
示例13: win_save_titlevoidwin_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,
示例14: IPADDRESS_IsBlankstatic 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,
示例15: SetLrgFontstaticHFONTSetLrgFont(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,
示例16: GetWindowTextLengthWNzString 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,
示例17: GetWindowTextLengthWString 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,
示例18: EnableOKButtonstatic 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,
示例19: GetWindowTextLengthWstd::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,
示例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,
示例21: GetWindowTextLengthWbool CWindow::GetText(UString &s){ if (g_IsNT) { s.Empty(); int length = GetWindowTextLengthW(_window); if (length == 0) return (::GetLastError() == ERROR_SUCCESS); length = GetWindowTextW(_window, s.GetBuffer(length), length + 1); s.ReleaseBuffer(); if (length == 0) return (::GetLastError() == ERROR_SUCCESS); return true; } CSysString sysString; bool result = GetText(sysString); s = GetUnicodeString(sysString); return result;}
开发者ID:BIAINC,项目名称:7Zip,代码行数:19,
示例22: WndProcLRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static HWND hwndEdit; HWND hwndButton; switch(msg) { case WM_CREATE: hwndEdit = CreateWindowW(L"Edit", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 50, 150, 20, hwnd, (HMENU) ID_EDIT, NULL, NULL); hwndButton = CreateWindowW(L"button", L"Set title", WS_VISIBLE | WS_CHILD, 50, 100, 80, 25, hwnd, (HMENU) ID_BUTTON, NULL, NULL); break; case WM_COMMAND: if (HIWORD(wParam) == BN_CLICKED) { int len = GetWindowTextLengthW(hwndEdit) + 1; wchar_t text[len]; GetWindowTextW(hwndEdit, text, len); SetWindowTextW(hwnd, text); } break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProcW(hwnd, msg, wParam, lParam);}
开发者ID:janbodnar,项目名称:Windows-API-examples,代码行数:41,
示例23: assertvoid ConsoleDialog::runStatement(){ assert(m_console != NULL); if (m_console) { HWND hText = ::GetDlgItem(_hSelf, IDC_INPUT); size_t length = GetWindowTextLengthW(hText); TCHAR *buffer = new TCHAR[length + 1]; GetWindowText(hText, buffer, length + 1); historyAdd(buffer); std::shared_ptr<char> charBuffer = WcharMbcsConverter::tchar2char(buffer); delete [] buffer; writeText(m_prompt.size(), m_prompt.c_str()); writeText(strlen(charBuffer.get()), charBuffer.get()); writeText(1, "/n"); SetWindowText(hText, _T("")); m_console->runStatement(charBuffer.get()); }}
开发者ID:asolomentsev,项目名称:PythonScript,代码行数:21,
示例24: VDGetWindowTextW32VDStringW VDGetWindowTextW32(HWND hwnd) { union { wchar_t w[256]; char a[512]; } buf; if (VDIsWindowsNT()) { int len = GetWindowTextLengthW(hwnd); if (len > 255) { vdblock<wchar_t> tmp(len + 1); len = GetWindowTextW(hwnd, tmp.data(), tmp.size()); VDStringW text(tmp.data(), len); return text; } else if (len > 0) { len = GetWindowTextW(hwnd, buf.w, 256); VDStringW text(buf.w, len); return text; } } else { int len = GetWindowTextLengthA(hwnd); if (len > 511) { vdblock<char> tmp(len + 1); len = GetWindowTextA(hwnd, tmp.data(), tmp.size()); VDStringW text(VDTextAToW(tmp.data(), len)); return text; } else if (len > 0) { len = GetWindowTextA(hwnd, buf.a, 512); VDStringW text(VDTextAToW(buf.a, len)); return text; } } return VDStringW();}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:40,
示例25: ChangeMapFontexternVOIDChangeMapFont(HWND hDlg){ HWND hCombo; HWND hMap; LPWSTR lpFontName; INT Len; hCombo = GetDlgItem(hDlg, 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); hMap = GetDlgItem(hDlg, IDC_FONTMAP); SendMessageW(hMap, FM_SETFONT, 0, (LPARAM)lpFontName); } HeapFree(GetProcessHeap(), 0, lpFontName); }}
开发者ID:darkvaderXD2014,项目名称:reactos,代码行数:39,
示例26: modify_dlgprocstatic INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ WCHAR* valueData; HWND hwndValue; int len; switch(uMsg) { case WM_INITDIALOG: SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, editValueName); SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData); CheckRadioButton(hwndDlg, IDC_DWORD_HEX, IDC_DWORD_DEC, isDecimal ? IDC_DWORD_DEC : IDC_DWORD_HEX); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_DWORD_HEX: if (isDecimal && change_dword_base(hwndDlg, TRUE)) isDecimal = FALSE; break; case IDC_DWORD_DEC: if (!isDecimal && change_dword_base(hwndDlg, FALSE)) isDecimal = TRUE; break; case IDOK: if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) { len = GetWindowTextLengthW(hwndValue); if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(WCHAR)))) { stringValueData = valueData; if (!GetWindowTextW(hwndValue, stringValueData, len + 1)) *stringValueData = 0; } } /* Fall through */ case IDCANCEL: EndDialog(hwndDlg, wParam); return TRUE; } } return FALSE;}
开发者ID:AlexSteel,项目名称:wine,代码行数:37,
示例27: sqlCmdWndProc INT_PTR CALLBACK sqlCmdWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { return (INT_PTR)TRUE; } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDCLOSE: EndDialog(hWnd, 0); break; case IDC_CLEAR: SetDlgItemText(hWnd, IDC_SCRIPT, 0); break; case IDC_EXECUTE: { SetDlgItemText(hWnd, IDC_RESULT, 0); int len = GetWindowTextLengthW(GetDlgItem(hWnd, IDC_SCRIPT)); wchar_t* sql = new wchar_t[len+2]; GetDlgItemTextW(hWnd, IDC_SCRIPT, sql, len+1); utfstring str(sql); PluginController::getInstance().dtb->executeSQL(str.toUTF8(), sqlQueryCallback, GetDlgItem(hWnd, IDC_RESULT)); delete [] sql; } break; } return (INT_PTR)TRUE; } } return (INT_PTR)FALSE; }
开发者ID:mmuszkow,项目名称:archStatusLog,代码行数:36,
示例28: IPADDRESS_GotoNextFieldstatic BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel){ TRACE("/n"); if(cur >= -1 && cur < 4) { IPADDRESS_ConstrainField(infoPtr, cur); if(cur < 3) { IPPART_INFO *next = &infoPtr->Part[cur + 1]; int start = 0, end = 0; SetFocus (next->EditHwnd); if (sel != POS_DEFAULT) { if (sel == POS_RIGHT) start = end = GetWindowTextLengthW(next->EditHwnd); else if (sel == POS_SELALL) end = -1; SendMessageW(next->EditHwnd, EM_SETSEL, start, end); } return TRUE; } } return FALSE;}
开发者ID:howard5888,项目名称:wineT,代码行数:24,
示例29: GetWindowRect/*Author : mahDate : 13.06.2002Description : Constructs InputBox window*/BOOL CInputBox::DoModal(LPCWSTR szCaption, LPCWSTR szPrompt){ RECT r; GetWindowRect(GetDesktopWindow(), &r); m_hWndInputBox = CreateWindowExW(WS_EX_TOOLWINDOW, L"InputBox", szCaption, WS_POPUPWINDOW | WS_CAPTION | WS_TABSTOP, (r.right - INPUTBOX_WIDTH) / 2, (r.bottom - INPUTBOX_HEIGHT) / 2, INPUTBOX_WIDTH, INPUTBOX_HEIGHT, m_hWndParent, NULL, m_hInst, NULL); if(m_hWndInputBox == NULL) return FALSE; SetWindowTextW(m_hWndPrompt, szPrompt); SetForegroundWindow(m_hWndInputBox); BringWindowToTop(m_hWndInputBox); EnableWindow(m_hWndParent, FALSE); ShowWindow(m_hWndInputBox, SW_SHOW); UpdateWindow(m_hWndInputBox); BOOL ret = 0; MSG msg; HWND hWndFocused; while (GetMessage(&msg, NULL, 0, 0)) { if (msg.message == WM_KEYDOWN) { if (msg.wParam == VK_ESCAPE) { SendMessage(m_hWndInputBox, WM_DESTROY, 0, 0); ret = 0; } if (msg.wParam == VK_RETURN) { int nCount = GetWindowTextLengthW(m_hWndEdit); nCount++; if (Text) { delete[] Text; Text = NULL; } Text = new WCHAR[nCount]; GetWindowTextW(m_hWndEdit, Text, nCount); SendMessage(m_hWndInputBox, WM_DESTROY, 0, 0); ret = 1; } if (msg.wParam == VK_TAB) { hWndFocused = GetFocus(); if (hWndFocused == m_hWndEdit) SetFocus(m_hWndOK); if (hWndFocused == m_hWndOK) SetFocus(m_hWndCancel); if (hWndFocused == m_hWndCancel) SetFocus(m_hWndEdit); } } TranslateMessage(&msg); DispatchMessage(&msg); } return ret;}
开发者ID:yecaokinux,项目名称:GD,代码行数:79,
注:本文中的GetWindowTextLengthW函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetWindowTheme函数代码示例 C++ GetWindowTextLength函数代码示例 |