void SelectProxy::ApplyChoice (SpellChecker *SpellCheckerInstance) { TCHAR *TBuf = 0; size_t BufSize = 0; BufSize = Edit_GetTextLength (HUserName) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HUserName, TBuf, BufSize); SpellCheckerInstance->SetProxyUserName (TBuf); CLEAN_AND_ZERO_ARR (TBuf); BufSize = Edit_GetTextLength (HHostName) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HHostName, TBuf, BufSize); SpellCheckerInstance->SetProxyHostName (TBuf); CLEAN_AND_ZERO_ARR (TBuf); BufSize = Edit_GetTextLength (HPassword) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HPassword, TBuf, BufSize); SpellCheckerInstance->SetProxyPassword (TBuf); CLEAN_AND_ZERO_ARR (TBuf); SpellCheckerInstance->SetUseProxy (Button_GetCheck (HUseProxy)); SpellCheckerInstance->SetProxyAnonymous (Button_GetCheck (HProxyAnonymous)); SpellCheckerInstance->SetProxyType (ComboBox_GetCurSel (HProxyType)); TBuf = new TCHAR[DEFAULT_BUF_SIZE]; Edit_GetText (HPort, TBuf, DEFAULT_BUF_SIZE); TCHAR *EndPtr; int x = _tcstol (TBuf, &EndPtr, 10); SpellCheckerInstance->SetProxyPort (x); CLEAN_AND_ZERO_ARR (TBuf); GetDownloadDics ()->Refresh (); }
/*------------------------------------------------------------------------------------------------------------------ -- FUNCTION: set_settings -- -- DATE: Febuary 6 2014 -- REVISIONS: none -- -- DESIGNER: Ramzi Chennafi -- PROGRAMMER: Ramzi Chennafi -- -- INTERFACE: void set_settings(HWND hwnd), takes the parent window HWND as an argument. -- -- RETURNS: void -- -- NOTES: -- Whenever the user hits "OK" on the settings dialog box, this function is called. The function will set the current -- value of the SETTINGS data in the Class Long Ptr to whatever is currently present in the settings dialog box. ----------------------------------------------------------------------------------------------------------------------*/ void set_settings(HWND hwnd){ char ** tempBuffers = (char**)malloc(sizeof(char*)* 4); for (int i = 0; i < 4; i++){ tempBuffers[i] = (char*) malloc(sizeof(char)* MAX_SIZE); } HWND hDlgPORT = GetDlgItem(hwnd, IDC_PORT); HWND hDlgIP = GetDlgItem(hwnd, IDC_IP); HWND hDlgSAVE = GetDlgItem(hwnd, IDC_SDISPLAY); HWND hDlgSPORT = GetDlgItem(hwnd, IDC_SPORT); HWND hDlgSPRTCL = GetDlgItem(hwnd, IDC_SPRTCL); HWND hDlgPCKT = GetDlgItem(hwnd, IDC_PACKETSIZE); HWND hDlgTTS = GetDlgItem(hwnd, IDC_TTS); SETTINGS * st = (SETTINGS*)GetClassLongPtr(GetParent(hwnd), 0); Edit_GetText(hDlgPORT, tempBuffers[0], MAX_SIZE); st->client_port = tempBuffers[0]; Edit_GetText(hDlgSPORT, tempBuffers[1], MAX_SIZE); st->server_port = tempBuffers[1]; Edit_GetText(hDlgIP, tempBuffers[2], MAX_SIZE); st->client_send_ip = tempBuffers[2]; Edit_GetText(hDlgTTS, tempBuffers[3], MAX_SIZE); st->times_to_send = tempBuffers[3]; st->packet_size = ComboBox_GetCurSel(hDlgPCKT); st->protocol = ComboBox_GetCurSel(hDlgSPRTCL); SetClassLongPtr(GetParent(hwnd), 0, (LONG)st); }
// // GetControlValues // void CAudioTransformFrameProperties::GetControlValues() { TCHAR sz[STR_MAX_LENGTH]; Edit_GetText(GetDlgItem(m_Dlg, IDC_PARAM1), sz, STR_MAX_LENGTH); int in=_ttoi(sz); m_pIZQAudioInterface->put_AudioMode(in); Edit_GetText(GetDlgItem(m_Dlg, IDC_PARAM2), sz, STR_MAX_LENGTH); //m_AudioTransformFrameParameters.param2 = _ttoi(sz); }
/* This function handles the WM_NOTIFY message. */ LRESULT FASTCALL RASBlinkProperties_OnNotify( HWND hwnd, int code, LPNMHDR lpnmhdr ) { switch( lpnmhdr->code ) { case PSN_HELP: HtmlHelp( hwnd, szHelpFile, HH_HELP_CONTEXT, idsBLINK_RAS ); break; case PSN_APPLY: { LPBLINKENTRY lpbe; HWND hwndTab; /* Update the blink entry structure. */ lpbe = (LPBLINKENTRY)GetWindowLong( hwnd, DWL_USER ); hwndTab = PropSheet_GetTabControl( GetParent( hwnd ) ); if( !TabCtrl_GetEnable( hwndTab, idRasTab ) ) lpbe->rd.fUseRAS = FALSE; else lpbe->rd.fUseRAS = IsDlgButtonChecked( hwnd, IDD_USERAS ); /* If we use RAS, we'll need the entry name. */ if( lpbe->rd.fUseRAS ) { HWND hwndList; /* Get the entry name. */ hwndList = GetDlgItem( hwnd, IDD_LIST ); ComboBox_GetText( hwndList, lpbe->rd.szRASEntryName, RAS_MaxEntryName+1 ); /* Get username and password. */ Edit_GetText( GetDlgItem( hwnd, IDD_USERNAME ), lpbe->rd.szRASUserName, UNLEN+1 ); Edit_GetText( GetDlgItem( hwnd, IDD_PASSWORD ), lpbe->rd.szRASPassword, PWLEN+1 ); if( ( strlen( lpbe->rd.szRASEntryName ) == 0 ) || ( strlen( lpbe->rd.szRASUserName ) == 0 ) || ( strlen( lpbe->rd.szRASPassword ) == 0 ) ) { fMessageBox( hwnd, 0, GS(IDS_STR1242), MB_OK|MB_ICONEXCLAMATION ); return( PSNRET_INVALID_NOCHANGEPAGE ); } Amuser_Encrypt( lpbe->rd.szRASPassword, rgEncodeKey ); } /* Force the Apply button to be disabled. */ PropSheet_UnChanged( GetParent( hwnd ), hwnd ); return( PSNRET_NOERROR ); } } return( FALSE ); }
void StartupComplete() { char str[200]; connection_node conn; session_node *s; len_admin_response_buf = 0; conn.type = CONN_CONSOLE; s = CreateSession(conn); if (s == NULL) FatalError("Interface can't make session for console"); s->account = GetConsoleAccount(); InitSessionState(s,STATE_ADMIN); console_session_id = s->session_id; if (Edit_GetText(GetDlgItem(HWND_STATUS,IDC_STARTUP_TEXT),str,sizeof(str)) == 0) StartupPrintf("No errors on startup\n"); SendDlgItemMessage(hwndMain,IDC_TOOLBAR,TB_ENABLEBUTTON,IDM_FILE_EXIT,MAKELPARAM(TRUE,0)); SendDlgItemMessage(hwndMain,IDC_TOOLBAR,TB_ENABLEBUTTON,IDM_FILE_SAVE,MAKELPARAM(TRUE,0)); SendDlgItemMessage(hwndMain,IDC_TOOLBAR,TB_ENABLEBUTTON,IDM_FILE_RELOADSYSTEM, MAKELPARAM(TRUE,0)); SendDlgItemMessage(hwndMain,IDC_TOOLBAR,TB_ENABLEBUTTON,IDM_MESSAGES_MESSAGEOFTHEDAY, MAKELPARAM(TRUE,0)); }
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); }
static BOOL FillStructureFromControls (HWND hwnd) { HWND hwndObjectType = GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE); HWND hwndDatabase = GetDlgItem (hwnd, IDC_LOCATE_DATABASE); HWND hwndFind = GetDlgItem (hwnd, IDC_LOCATE_FIND); LPLOCATEPARAMS lplocate = GetDlgProp (hwnd); int nSel; char szObjectType [MAXOBJECTNAME]; char szDatabase [MAXOBJECTNAME]; char szFind [MAXOBJECTNAME]; ZEROINIT (szObjectType); ZEROINIT (szDatabase ); ZEROINIT (szFind ); ComboBox_GetText (hwndObjectType, szObjectType, sizeof (szObjectType)); if (IsWindowEnabled (hwndDatabase)) ComboBox_GetText (hwndDatabase , szDatabase , sizeof (szDatabase )); Edit_GetText (hwndFind, szFind, sizeof (szFind)); if ((nSel = ComboBox_GetCurSel (hwndObjectType)) != CB_ERR) lplocate->ObjectType = Obj4locate() [nSel]; else lplocate->ObjectType = -1; x_strcpy (lplocate->DBName, szDatabase); x_strcpy (lplocate->FindString, szFind); if (!ProhibitString_all2 (hwnd)) return FALSE; return TRUE; }
std::wstring ds3t::UI::EditBox::get_value_str (void) { wchar_t val_str [32]; Edit_GetText (handle, val_str, 32); return std::wstring (val_str); }
void OnOk(HWND hW) { int i = ComboBox_GetCurSel(GetDlgItem(hW, IDC_ETHDEV)); if (i == -1) { //adapter not selected if (Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED))) { //Trying to use an ethernet without //selected adapter, we can't have that SysMessage("Please select an ethernet adapter"); return; } else { //user not planning on using //ethernet anyway strcpy(config.Eth, ETH_DEF); } } else { //adapter is selected char* ptr = (char*)ComboBox_GetItemData(GetDlgItem(hW, IDC_ETHDEV), i); strcpy(config.Eth, ptr); } Edit_GetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd, 256); config.ethEnable = Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED)); config.hddEnable = Button_GetCheck(GetDlgItem(hW, IDC_HDDENABLED)); SaveConf(); EndDialog(hW, TRUE); }
void choosePath( HWND parent, int hostCtlId ) { HWND hostControl = GetDlgItem( parent, hostCtlId ); BROWSEINFOW dialog; wchar_t path[MAX_PATH]; // buffer for file name Edit_GetText( hostControl, path, sizeof(path) ); ZeroMemory(&dialog,sizeof(dialog)); dialog.lpszTitle = L"Pick a CA Path"; dialog.hwndOwner = parent; dialog.pszDisplayName = path; LPITEMIDLIST pidl = SHBrowseForFolder ( &dialog ); if ( pidl ) { SHGetPathFromIDList ( pidl, path ); Edit_SetText( hostControl, path ); IMalloc * imalloc = 0; if ( SUCCEEDED( SHGetMalloc ( &imalloc )) ) { imalloc->Free ( pidl ); imalloc->Release ( ); } } }
/* * LookVkeyToItem: Handle WM_VKTOITEM messages. */ int LookVkeyToItem(HWND hwnd, UINT key, HWND hwndListbox, int iCaret) { char buf[MAXNAME + 1]; int len; len = Edit_GetText(info->hwndFind, buf, MAXNAME); /* Backspace removes last character, if any */ if (key == VK_BACK) { if (len != 0) { buf[len - 1] = '\0'; Edit_SetText(info->hwndFind, buf); } return -2; } /* Add letter character to edit box */ key = tolower(key); if (key >= 'a' && key <= 'z') { if (len < MAXNAME) { buf[len + 1] = '\0'; buf[len] = tolower(key); Edit_SetText(info->hwndFind, buf); } return -2; } return -1; }
virtual std::wstring text() const { wchar_t buf[512] = { 0 }; Edit_GetText( _hwnd, buf, ARRAYSIZE( buf ) ); return buf; }
int CHandVuFilterProperties::GetTextSliderCombination(int idc_textbox, int idc_slider, int val_old) { int val_textbox; int val_slider; TCHAR sz[4]; Edit_GetText(GetDlgItem(m_Dlg, idc_textbox), sz, 4); val_textbox = atoi(sz); // Quick validatation of the field if (val_textbox < 0) val_textbox = 0; if (val_textbox > 255) val_textbox = 255; val_slider = GetSliderPos( idc_slider ); // textbox has priority if (val_old != val_textbox) { return val_textbox; } else if (val_old != val_slider) { return val_slider; } else { return val_old; } }
/** * name: EndLabelEdit * class: CPsTree * desc: exits the labeledit mode * bSave - tell whether to save changes or not * return: 0 **/ int CPsTree::EndLabelEdit(const BYTE bSave) { TCHAR szEdit[MAX_TINAME]; TVITEM tvi; WORD cchEdit; if (bSave && (cchEdit = Edit_GetText(_hLabelEdit, szEdit, MAX_TINAME)) > 0) { tvi.hItem = _hDragItem; tvi.mask = TVIF_TEXT|TVIF_HANDLE; tvi.pszText = szEdit; if (TreeView_SetItem(_hWndTree, &tvi)) { CPsTreeItem* pti; if (pti = FindItemByHandle(_hDragItem)) { pti->Rename(szEdit); } _dwFlags |= PSTVF_LABEL_CHANGED; } } DestroyWindow(_hLabelEdit); _hLabelEdit = NULL; _hDragItem = NULL; return 0; }
/// Generates the truth table. void MainWindow::generate() { delete_columns(); get_variables(); FunctionParser p; switch(m_mode) { case Function: char func[128]; Edit_GetText(m_hWndFunction, func, 128); try { p = FunctionParser(m_variables, func); } catch(FunctionParser::FunctionParserException& e) { MessageBox(e.what(), "Function Parser Error", MB_OK | MB_ICONERROR); return; } build_table(&p); break; case Minterm: break; case Maxterm: break; } }
// Create an array of button mapping data and send it to the parent window // Return the number of buttons in map void SppBtnsDlg::SendButtonsMappingData(void) { TCHAR text[5]; HWND hEditCh; UINT count=0; BTNArr aButtonMap; aButtonMap.fill(0); auto size = m_ahEdtBtn.size(); for (UINT i=0; i<size; i++) { hEditCh = m_ahEdtBtn[i]; if (!hEditCh) break; // Get data from edit box Edit_GetText(m_ahEdtBtn[i], text, 5); aButtonMap[i] = (UINT)_ttoi(text); count++; }; // Send message to parent window SendMessage(m_ParentWnd, WMSPP_DLG_MAPBTN, (WPARAM)&aButtonMap, count); }
void chooseFile( HWND parent, int hostCtlId ) { OPENFILENAMEW dialog; HWND hostControl = GetDlgItem( parent, hostCtlId ); wchar_t szFile[MAX_PATH]; // buffer for file name Edit_GetText( hostControl, szFile, sizeof(szFile) ); // Initialize OPENFILENAME ZeroMemory(&dialog, sizeof(dialog)); dialog.lStructSize = sizeof(dialog); dialog.lpstrFile = szFile; dialog.lpstrTitle = L"Select File"; dialog.nMaxFile = sizeof(szFile); dialog.lpstrFileTitle = NULL; dialog.nMaxFileTitle = 0; dialog.lpstrInitialDir = NULL; dialog.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST ; dialog.hwndOwner = parent; dialog.lpstrCustomFilter = L"All Files\0*.*\0PEM\0*.pem\0"; dialog.nFilterIndex = 2; if ( GetOpenFileNameW( &dialog ) ) { Edit_SetText( hostControl, dialog.lpstrFile ); } }
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; }
void CMotionFilterProperties::GetControlValues() { ASSERT(m_pIPEffect); TCHAR sz[STR_MAX_LENGTH]; REFTIME tmp1, tmp2 ; // Get the start and effect times Edit_GetText(GetDlgItem(m_Dlg, IDC_LENGTH), sz, STR_MAX_LENGTH); #ifdef UNICODE int rc; // Convert Multibyte string to ANSI char szANSI[STR_MAX_LENGTH]; rc = WideCharToMultiByte(CP_ACP, 0, sz, -1, szANSI, STR_MAX_LENGTH, NULL, NULL); tmp2 = COARefTime(atof(szANSI)); #else tmp2 = COARefTime(atof(sz)); #endif Edit_GetText(GetDlgItem(m_Dlg, IDC_START), sz, STR_MAX_LENGTH); #ifdef UNICODE // Convert Multibyte string to ANSI rc = WideCharToMultiByte(CP_ACP, 0, sz, -1, szANSI, STR_MAX_LENGTH, NULL, NULL); tmp1 = COARefTime(atof(szANSI)); #else tmp1 = COARefTime(atof(sz)); #endif // Quick validatation of the fields if (tmp1 >= 0 && tmp2 >= 0) { m_start = tmp1; m_length = tmp2; } // Find which special effect we have selected for (int i = IDC_EMBOSS; i <= IDC_NONE; i++) { if (IsDlgButtonChecked(m_Dlg, i)) { m_effect = i; break; } } }
void SaveState() { int len = Edit_GetTextLength( hwAnswer ); char *str = new char[ len+1 ]; Edit_GetText( hwAnswer, str, len+1 ); ex.set_answer( curr, str ); delete [] str; }
void CHandVuFilterProperties::SetText( int idc_textbox, int pos ) { const int szlen = 4; TCHAR sz[szlen]; Edit_GetText(GetDlgItem(m_Dlg, idc_textbox), sz, 4); if (pos != atoi(sz)) { //StringCbPrintf(sz, szlen*sizeof(TCHAR), TEXT("%2.d"), pos); _stprintf(sz, TEXT("%2.d"), pos); Edit_SetText(GetDlgItem(m_Dlg, idc_textbox), sz); } }
static void ConsoleWndVerbosityApply(void) { char buffer[64]; HWND hwnd; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT_VERBOSITY); if(!IsWindow(hConsoleWnd)) return; if(Edit_GetText(hwnd,buffer,60)<=0) return; ctl->verbosity = atoi(buffer); ConsoleWndVerbosityUpdate(); }
void OptionTabWindow::get() { HWND w; struct HpcMenuInterface::HpcMenuPreferences &pref = HPC_PREFERENCE; if (IS_CHECKED(AUTO)) { TCHAR tmp[32]; Edit_GetText(_spin_edit, tmp, 32); pref.auto_boot = _wtoi(tmp); } else pref.auto_boot = 0; pref.reverse_video = IS_CHECKED(VIDEO); pref.pause_before_boot = IS_CHECKED(PAUSE); pref.load_debug_info = IS_CHECKED(DEBUG); pref.safety_message = IS_CHECKED(SAFETY); w = GetDlgItem(_window, IDC_OPT_EXTKOPT); Edit_GetText(w, pref.boot_extra, MAX_BOOT_STR); }
/// Saves the truth table to an excel parsable text file. void MainWindow::save() { /* FIXME: what we write is mode dependant */ char outfile[MAX_PATH]; strncpy(outfile, m_last_save_file.c_str(), MAX_PATH); OPENFILENAME of; memset(&of, 0, sizeof(of)); of.lStructSize = sizeof(OPENFILENAME); of.hwndOwner = handle(); of.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; of.lpstrDefExt = "txt"; of.lpstrFile = outfile; of.nMaxFile = MAX_PATH; of.Flags = OFN_EXPLORER | OFN_CREATEPROMPT | OFN_HIDEREADONLY | OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; if(!GetSaveFileName(&of)) return; m_last_save_file = outfile; std::ofstream f(outfile); if(!f) { MessageBox("Could not open output file", "File Error", MB_OK | MB_ICONERROR); return; } char function[128]; Edit_GetText(m_hWndFunction, function, 128); f << "f = " << function << std::endl << std::endl; for(std::list<char>::const_iterator it = m_variables.begin(); it != m_variables.end(); ++it) f << *it << "\t"; f << "f" << std::endl; int items = ListView_GetItemCount(m_hWndTable); char t[8]; memset(t, 0, 8); LVITEM lvi; lvi.mask = LVIF_TEXT; lvi.pszText = t; lvi.cchTextMax = 8; for(int i=0; i<items; ++i) { lvi.iItem = i; for(size_t j=0; j<m_variables.size(); ++j) { lvi.iSubItem = static_cast<int>(j); ListView_GetItem(m_hWndTable, &lvi); f << t << "\t"; } lvi.iSubItem = static_cast<int>(m_variables.size()); ListView_GetItem(m_hWndTable, &lvi); f << t << std::endl; } f.close(); }
// Add a string to an edit control void AddText(HWND hwnd, PCTSTR pszFormat, ...) { va_list argList; va_start(argList, pszFormat); TCHAR sz[20 * 1024]; Edit_GetText(hwnd, sz, _countof(sz)); _vstprintf_s(_tcschr(sz, TEXT('\0')), _countof(sz) - _tcslen(sz), pszFormat, argList); Edit_SetText(hwnd, sz); va_end(argList); }
static void EnableDisableOKButton (HWND hwnd) { HWND hwndMailTaxt = GetDlgItem (hwnd, IDC_MAIL_TEXT); char szText [MAX_MAIL_TEXTLEN]; Edit_GetText (hwndMailTaxt, szText, sizeof (szText)); if (x_strlen (szText) == 0) EnableWindow (GetDlgItem (hwnd, IDOK), FALSE); else EnableWindow (GetDlgItem (hwnd, IDOK), TRUE); }
static ErrNo GetLine_Int(HWND hwndEdit,int &nParameter) { int iLength; TCHAR Buffer[MAXINPUT]; iLength = Edit_GetText(hwndEdit,Buffer,MAXINPUT-1); if(!iLength) return NO_DATA_INPUT; nParameter = _wtoi(Buffer); return 0; }
char *StringConfigControl::GetPszValue() { int i_size; char *psz_result; TCHAR *psz_string; i_size = Edit_GetTextLength( textctrl ); psz_string = (TCHAR *)malloc( (i_size + 1) * sizeof(TCHAR) ); Edit_GetText( textctrl, psz_string, i_size + 1 ); psz_result = strdup( _TOMB(psz_string) ); free( psz_string ); return psz_result; }
// Text des Edit-Fenster ins Clipboard kopieren BOOL CopyTextToClipBoard (HWND hMainWnd, HWND hEditWnd) { DWORD dwLen = 0; HGLOBAL hBuffer = 0; void FAR*pBuffer = NULL; BOOL bRet = TRUE; // Länge des Textes bestimmen dwLen = Edit_GetTextLength (hEditWnd) + 1; if (!dwLen) // kein Text gefunden return FALSE; // Speicher anfordern hBuffer = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT | GMEM_SHARE, dwLen); if (!hBuffer) { MessageBox (hMainWnd, "Nicht genügend Speicher.", "TriasED", MB_OK | MB_ICONHAND); return FALSE; } pBuffer = GlobalLock (hBuffer); if (!pBuffer) { GlobalFree (hBuffer); MessageBox (hMainWnd, "Fehler beim Verriegeln des Speichers.", "TriasED", MB_OK | MB_ICONHAND); return FALSE; } // Editor-Text lesen Edit_GetText (hEditWnd, pBuffer, LOWORD (dwLen)); GlobalUnlock (hBuffer); // Speicher entriegeln // Text kopieren if (bRet = OpenClipboard (hMainWnd)) { if (bRet = EmptyClipboard ()) { // Clipboard "leeren" hBuffer = SetClipboardData (CF_TEXT, hBuffer); // Daten kopieren bRet = hBuffer ? TRUE : FALSE; // freigeben der Daten mit CloseClipboard () } else GlobalFree (hBuffer); // Speicher freigeben } else GlobalFree (hBuffer); // Speicher freigeben CloseClipboard (); // Clipboard schließen // ggf. Fehlermeldung ausgeben if (bRet == FALSE) MessageBox (hMainWnd, "Fehler beim Kopieren der Daten.", "TriasED", MB_OK | MB_ICONHAND); return bRet; }
void getStrFieldData(HWND hwnd, SQLWCHAR **param, int idc) { x_free(*param); *param= NULL; int len = Edit_GetTextLength(GetDlgItem(hwnd,idc)); if (len>0) { *param= (SQLWCHAR *)myodbc_malloc((len + 1) * sizeof(SQLWCHAR), MYF(0)); if (*param) Edit_GetText(GetDlgItem(hwnd,idc), *param, len+1); } }