Click here to Skip to main content
16,004,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing private class members Pin
Ian Darling10-Feb-04 13:58
Ian Darling10-Feb-04 13:58 
GeneralRe: Accessing private class members Pin
John R. Shaw10-Feb-04 14:17
John R. Shaw10-Feb-04 14:17 
GeneralRe: Accessing private class members Pin
georgiek5010-Feb-04 14:58
georgiek5010-Feb-04 14:58 
GeneralVisual C++ 6 +7 Pin
Rohde10-Feb-04 12:41
Rohde10-Feb-04 12:41 
GeneralRe: Visual C++ 6 +7 Pin
Christian Graus10-Feb-04 15:52
protectorChristian Graus10-Feb-04 15:52 
GeneralRe: Visual C++ 6 +7 Pin
shultas10-Feb-04 16:11
shultas10-Feb-04 16:11 
GeneralRe: Visual C++ 6 +7 Pin
Tim Smith10-Feb-04 18:19
Tim Smith10-Feb-04 18:19 
GeneralUsing an edit box from other file. Help needed!! Pin
satcat10-Feb-04 12:30
satcat10-Feb-04 12:30 
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:
<br />
CIVOCOMDlg::CIVOCOMDlg(CWnd* pParent /*=NULL*/)<br />
: CDialog(CIVOCOMDlg::IDD, pParent)<br />
{<br />
//{{AFX_DATA_INIT(CIVOCOMDlg)<br />
m_strHeard = _T("");<br />
//}}AFX_DATA_INIT<br />
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32<br />
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);<br />
}<br />
<br />
void CIVOCOMDlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
//{{AFX_DATA_MAP(CIVOCOMDlg)<br />
DDX_Text(pDX, IDC_GOT, m_strHeard);<br />
//}}AFX_DATA_MAP<br />
}<br />

Then in this code1.cpp I create a Grammar object:
<br />
BOOL loadGrammar( TCHAR *pszFile, BOOL bDictGram,<br />
ISRGramCommon **ppISRGramCommon )<br />
{<br />
...<br />
// load the grammar and register our notify sink<br />
IUnknown * pIUnkGram;<br />
// create dictation grammar notify sink<br />
// CGramDictSink *pGramDictSink = new CGramDictSink( hDlg );<br />
CGramDictSink *pGramDictSink = new CGramDictSink(NULL);<br />
pGramDictSink->AddRef();<br />
<br />
hRes = g_pISRCentral->GrammarLoad( SRGRMFMT_DICTATION, sData,<br />
pGramDictSink, IID_ISRGramNotifySink,<br />
&pIUnkGram );<br />
<br />
pGramDictSink->Release();<br />
...<br />
hRes = pIUnkGram->QueryInterface( IID_ISRGramCommon,(void **)ppISRGramCommon );<br />
pIUnkGram->Release();<br />
<br />
hRes = (*ppISRGramCommon)->Activate( NULL, FALSE, NULL );<br />
<br />
return SUCCEEDED( hRes );<br />
}<br />

In the code2.cpp file I have:
<br />
// notifies client that a recognition has completed<br />
STDMETHODIMP CGramCFGSink::PhraseFinish( DWORD dwFlags,<br />
QWORD /*qTimeStampBegin*/,<br />
QWORD /*qTimeStampEnd*/,<br />
PSRPHRASE pSRPhrase,<br />
LPUNKNOWN /*lpResults*/ )<br />
{<br />
// ignore if not a recognition from this grammar<br />
if( !( dwFlags & ISRNOTEFIN_RECOGNIZED ) ||<br />
!( dwFlags & ISRNOTEFIN_THISGRAMMAR ) )<br />
{<br />
return S_OK;<br />
}<br />
<br />
// retrieve the recognized text from SRPHRASE structure<br />
PSRWORD pSRMax = (PSRWORD)( (BYTE*)pSRPhrase + pSRPhrase->dwSize );<br />
PSRWORD pSRWord = (PSRWORD)( pSRPhrase->abWords );<br />
TCHAR szText[256] = { _T('\0') };<br />
int nWords = 0;<br />
while( pSRWord < pSRMax )<br />
{<br />
// add a space between words<br />
if( nWords++ != 0 )<br />
_tcscat( szText, _T(" ") );<br />
<br />
_tcscat( szText, pSRWord->szWord );<br />
pSRWord = (PSRWORD)( (BYTE *)pSRWord + pSRWord->dwSize );<br />
}<br />
<br />
SetDlgItemText(m_hDlg, IDC_GOT, "Unrecognized\0");<br />
return S_OK;<br />
}<br />


This SetDlgItemText(m_hDlg, IDC_GOT, "Unrecognized\0"); doesn't work... It should write in the edit box the text "Unrecognized" whichever I say. I don't know what could I do so it works. Please, help me!

Thank you!

I have no idea D'Oh! | :doh:
GeneralSubclassing or Derviving Pin
monrobot1310-Feb-04 12:27
monrobot1310-Feb-04 12:27 
GeneralRe: Subclassing or Derviving Pin
John R. Shaw10-Feb-04 12:49
John R. Shaw10-Feb-04 12:49 
GeneralRe: Subclassing or Derviving Pin
mcsweeneyd10-Feb-04 15:38
mcsweeneyd10-Feb-04 15:38 
GeneralRe: Subclassing or Derviving Pin
monrobot1311-Feb-04 10:04
monrobot1311-Feb-04 10:04 
GeneralStrange memory overrun Pin
John R. Shaw10-Feb-04 10:43
John R. Shaw10-Feb-04 10:43 
GeneralRe: Strange memory overrun Pin
Tom Larsen10-Feb-04 11:30
Tom Larsen10-Feb-04 11:30 
GeneralRe: Strange memory overrun Pin
John R. Shaw10-Feb-04 12:37
John R. Shaw10-Feb-04 12:37 
GeneralRe: Strange memory overrun Pin
Tom Larsen11-Feb-04 5:00
Tom Larsen11-Feb-04 5:00 
QuestionHow to adding &quot;Start parameters&quot; to a Window service Pin
sysmatrix10-Feb-04 10:09
sysmatrix10-Feb-04 10:09 
AnswerRe: How to adding &quot;Start parameters&quot; to a Window service Pin
Peter Weyzen10-Feb-04 11:31
Peter Weyzen10-Feb-04 11:31 
GeneralDoubts with sorting stl vector... Pin
Cloaca10-Feb-04 9:32
Cloaca10-Feb-04 9:32 
GeneralRe: Doubts with sorting stl vector... Pin
David Crow10-Feb-04 10:05
David Crow10-Feb-04 10:05 
GeneralRe: Doubts with sorting stl vector... Pin
Cloaca10-Feb-04 10:14
Cloaca10-Feb-04 10:14 
GeneralRe: Doubts with sorting stl vector... Pin
David Crow10-Feb-04 10:34
David Crow10-Feb-04 10:34 
GeneralRe: Doubts with sorting stl vector... Pin
Cloaca11-Feb-04 6:48
Cloaca11-Feb-04 6:48 
GeneralRe: Doubts with sorting stl vector... Pin
valikac10-Feb-04 10:07
valikac10-Feb-04 10:07 
GeneralRe: Doubts with sorting stl vector... Pin
Cloaca10-Feb-04 10:18
Cloaca10-Feb-04 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.