Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using an edit box from other file. Help needed!!

Using an edit box from other file. Help needed!!

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    satcat
    wrote on last edited by
    #1

    I'm trying to make an application that uses a speech recognizer engine but it should write from a .cpp file in the dialogbox defined in other .cpp file and I don't know how could I do. Here is some of my code so you can understand me better: In my main code1.cpp I have defined a edit box with a member variable. In my code it appears on this way: CIVOCOMDlg::CIVOCOMDlg(CWnd* pParent /*=NULL*/) : CDialog(CIVOCOMDlg::IDD, pParent) { //{{AFX_DATA_INIT(CIVOCOMDlg) m_strHeard = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CIVOCOMDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CIVOCOMDlg) DDX_Text(pDX, IDC_GOT, m_strHeard); //}}AFX_DATA_MAP } Then in this code1.cpp I create a Grammar object: BOOL loadGrammar( TCHAR *pszFile, BOOL bDictGram, ISRGramCommon **ppISRGramCommon ) { ... // load the grammar and register our notify sink IUnknown * pIUnkGram; // create dictation grammar notify sink // CGramDictSink *pGramDictSink = new CGramDictSink( hDlg ); CGramDictSink *pGramDictSink = new CGramDictSink(NULL); pGramDictSink->AddRef(); hRes = g_pISRCentral->GrammarLoad( SRGRMFMT_DICTATION, sData, pGramDictSink, IID_ISRGramNotifySink, &pIUnkGram ); pGramDictSink->Release(); ... hRes = pIUnkGram->QueryInterface( IID_ISRGramCommon,(void **)ppISRGramCommon ); pIUnkGram->Release(); hRes = (*ppISRGramCommon)->Activate( NULL, FALSE, NULL ); return SUCCEEDED( hRes ); } In the code2.cpp file I have: // notifies client that a recognition has completed STDMETHODIMP CGramCFGSink::PhraseFinish( DWORD dwFlags, QWORD /*qTimeStampBegin*/, QWORD /*qTimeStampEnd*/, PSRPHRASE pSRPhrase, LPUNKNOWN /*lpResults*/ ) { // ignore if not a recognition from this grammar if( !( dwFlags & ISRNOTEFIN_RECOGNIZED ) || !( dwFlags & ISRNOTEFIN_THISGRAMMAR ) ) { return S_OK; } // retrieve the recognized text from SRPHRASE structure PSRWORD pSRMax = (PSRWORD)( (BYTE*)pSRPhrase + pSRPhrase->dwSize ); PSRWORD pSRWord = (PSRWORD)( pSRPhrase->abWords ); TCHAR szText[256] = { _T('\0') }; int nWords = 0; while( pSRWord < pSRMax ) { // add a space between words if( nWords++ != 0 ) _tcscat( szText, _T(" ") ); _tcscat( szText, pSRWord->szWord ); pSRWord = (PSRWORD)( (BYTE *)pSRWord + pSRWord->dwSize ); } SetDlgItemText(m_hDlg, IDC_GOT, "Unrecognized\0"); return S_OK; } This SetDlgItem

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups