Click here to Skip to main content
16,016,501 members
Home / Discussions / COM
   

COM

 
GeneralRe: CLSID's Pin
#realJSOP14-Oct-01 7:01
professional#realJSOP14-Oct-01 7:01 
GeneralRe: CLSID's Pin
Not Active14-Oct-01 9:10
mentorNot Active14-Oct-01 9:10 
GeneralRe: CLSID's Pin
#realJSOP14-Oct-01 10:29
professional#realJSOP14-Oct-01 10:29 
GeneralRe: CLSID's Pin
#realJSOP15-Oct-01 5:09
professional#realJSOP15-Oct-01 5:09 
GeneralRe: CLSID's Pin
Aaron Schaefer15-Oct-01 9:53
Aaron Schaefer15-Oct-01 9:53 
GeneralRe: CLSID's Pin
Tim Smith15-Oct-01 10:34
Tim Smith15-Oct-01 10:34 
GeneralRe: CLSID's Pin
#realJSOP16-Oct-01 2:58
professional#realJSOP16-Oct-01 2:58 
GeneralNetmeeting 3 -- help! Pin
aniel12-Oct-01 13:17
aniel12-Oct-01 13:17 
I am working on a project that will recieve netmeeting calls. Upon connection it will open an audiostream, and then watch the state of the INmChannelAudio object. More precisely, the INmChannelAudio object is supposed to provide an automatic callback to the INmChannelAudioNotify class, which I have written according to the samples provided by microsoft. However, for some reason it never calls back that function. Also, when I manually try to check the state of the INmChannelAudio object via the calls GetState and IsIncoming, GetState returns NM_AUDIO_TRANSFERRING once the audio object has become active, unless it has been set to pause, in which case it returns NM_AUDIO_PAUSED. IsIncoming() always returns S_FALSE, even when there is audible data coming from the speakers.

So I am led o a couple of assumptions -- Either my code to check the state is wrong, or I am connected to the object wrong. I'm almost certain my code to check the state is correct, since it changes. I am not sure about IsIncoming though, because it always returns S_FALSE. the code I have been using is

HRESULT hr;
NM_AUDIO_STATE puState;
PUSER pUser = (PUSER) PUserLocal();
INmChannelAudio * pChannel = pUser->m_pChannelAudio;
pChannel->GetState(&puState);
hr = pChannel->IsIncoming();

However, no matter what, this code doesn't really matter. I am using it to debug. My main problem is the class CAudNotify which is the INmChannelAudioNotify class. As I said before, the INmChannelAudio class, which is predefined, is supposed to call back to my CAudNotify class once they are connected. Since it does not, I assume my connect code is flawed. Here is that code:


//Class declaration
class CAudNotify : public RefCount, public CNotify, public INmChannelAudioNotify
{
public:
CAudNotify();
~CAudNotify();

// INmChannelAudioNotify
HRESULT STDMETHODCALLTYPE NmUI(CONFN uNotify);
HRESULT STDMETHODCALLTYPE MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember * pMember);
HRESULT STDMETHODCALLTYPE StateChanged(NM_AUDIO_STATE uState);
HRESULT STDMETHODCALLTYPE PropertyChanged(DWORD dwReserved);

// ICNotify methods
HRESULT STDMETHODCALLTYPE Connect (IUnknown *pUnk);
HRESULT STDMETHODCALLTYPE Disconnect(void);

// IUnknown methods
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppvObj);
};


//and class code


HRESULT HookAudio(INmChannel * pChannel)
{
HRESULT hr;
CAudNotify * pNotify;
ASSERT(NULL != pChannel);
if(NULL != g_pChannelAudio)
{
g_pChannelAudio->Release();
MessageBox(NULL,"HookAudio: replacing existing g_pChannelAudio","call",MB_OK);
}
if(NULL != g_pChannelAudio)
{
g_pNotifyAud->Disconnect();
g_pNotifyAud->Release();
}
hr = pChannel->QueryInterface(IID_INmChannelAudio, (void **)&g_pChannelAudio);
if (FAILED(hr))
{
MessageBox(NULL,"HookAudio: Unable to get Audio channel","call",MB_OK);
return hr;
}

pNotify = new CAudNotify();
if(NULL == pNotify)
{
hr = E_OUTOFMEMORY;
}
else
{
hr = pNotify->Connect(g_pChannelAudio);
if(FAILED(hr))
{
MessageBox(NULL,"CAudNotify Failed" ,"call",MB_OK);
pNotify->Release();
}
else
{
MessageBox(NULL,"Audio Connection point established successfully" ,"call",MB_OK);
g_pNotifyAud = pNotify;
}
}
if(FAILED(hr))
{
MessageBox(NULL,"Audio Connection point failed" ,"call",MB_OK);
g_pChannelAudio->Release();
g_pChannelAudio = NULL;
}
return hr;
}


HRESULT STDMETHODCALLTYPE CAudNotify::QueryInterface(REFIID riid, PVOID *ppvObject)
{
HRESULT hr = S_OK;
*ppvObject = NULL;
if (riid == IID_IUnknown)
{
*ppvObject = (IUnknown *)this;
MessageBox(NULL,"CAudNotify::QueryInterface(): Returning IUnknown.","call",MB_OK);
}
else if (riid == IID_INmChannelAudioNotify)
{
*ppvObject = (/*INmChannelAudioNotify*/PVOID *)this;
MessageBox(NULL,"CChannelAudioNotify::QueryInterface(): Returning INmChannelAudioNotify.","call",MB_OK);
}
else
{
hr = E_NOINTERFACE;
*ppvObject = NULL;
MessageBox(NULL,"CAudNotify::QueryInterface(): Called on unknown interface.","call",MB_OK);
}

if (S_OK == hr)
{
AddRef();
}

return hr;
}


HRESULT CAudNotify::Connect(IUnknown *pUnk)
{
MessageBox(NULL,"CAudNotify::Connect","call",MB_OK);
return CNotify::Connect(pUnk, IID_INmChannelAudioNotify, (IUnknown *)this);
}


HRESULT STDMETHODCALLTYPE CAudNotify::MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
{
MessageBox(NULL,"MemberChanged","caudnotify",MB_OK);
PUSER pUser = PUserFromINmMember(pMember);
if(NULL!=pUser) UpdateUserChannel(pUser, (INmChannel *) (CNotify::GetPunk()), uNotify);
return S_OK;
}




HRESULT STDMETHODCALLTYPE CAudNotify::PropertyChanged(DWORD dwReserved)
{
MessageBox(NULL,"call to caudnotify::propertychanged","call",MB_OK);
return S_OK;
}


HRESULT STDMETHODCALLTYPE CAudNotify::StateChanged(NM_AUDIO_STATE uState)
{
//I believe this is where we'll check whether audio is incoming or outgoing and therefore whether to turn on PTT or off
MessageBox(NULL,"call to caudnotify::statechanged","call",MB_OK);
IID iid;
HRESULT hr;
INmChannelAudio *pAudioChannel;
hr = QueryInterface(iid,(void **)&pAudioChannel);
if (SUCCEEDED(hr))
if (uState == NM_AUDIO_TRANSFERRING){
MessageBox(NULL,"Transferring","duh",MB_OK);
if (pAudioChannel->IsIncoming()==S_OK){
PTTOn('A');
}
else{
PTTOn(0);
}
}
// }
return S_OK;
}



There are other bits and pieces of code in the class, but they probably have no connection.

So the problem is I don't even get that messagebox in ::MemberChanged, ::StateChanged, or ::PropertyChanged.

Please help!!
Thanks a million,
Aniel Sud



--UPDATE--

I found that the QueryInterface method is being called with several IIDs that I had not before heard of -- namely IID_IMarshall, IID_IStdMarshall, IID_IexternalConnection, and 0000001B-0000-0000-C000-000000000046. I did a search for IID_IMarshall, and came back with one newsletter that was very vague. But it did say something about requiring marshalling. What is marshalling? do I need it in this instance?

Thanks again for all the help!!


--UPDATE--

I have found out about marshalling, and I don't think I should need it in an app such as this. Moreover, I don't see anything about marshalling in the samples. Is it ok to just let these requests slide?

Thanks again!

Aniel

GeneralRe: Netmeeting 3 -- help! Pin
aniel15-Oct-01 8:15
aniel15-Oct-01 8:15 
GeneralCWnd inside a COleControl does'nt work Pin
Remi Morin12-Oct-01 5:38
Remi Morin12-Oct-01 5:38 
GeneralDCOMCNFG and InstallShield Pin
Firoz12-Oct-01 3:03
Firoz12-Oct-01 3:03 
GeneralRe: DCOMCNFG and InstallShield Pin
Tim Smith12-Oct-01 3:11
Tim Smith12-Oct-01 3:11 
GeneralRe: DCOMCNFG and InstallShield Pin
Firoz14-Oct-01 19:26
Firoz14-Oct-01 19:26 
QuestionHOWTO: Pass VB string into VC++ created ATL Object? Pin
Tim Rymer11-Oct-01 10:31
Tim Rymer11-Oct-01 10:31 
AnswerRe: HOWTO: Pass VB string into VC++ created ATL Object? Pin
Chris Losinger11-Oct-01 10:33
professionalChris Losinger11-Oct-01 10:33 
GeneralCOM client structure Pin
Peter Molnar11-Oct-01 8:29
Peter Molnar11-Oct-01 8:29 
GeneralRe: COM client structure Pin
Amit Dey13-Oct-01 6:21
Amit Dey13-Oct-01 6:21 
GeneralRe: COM client structure Pin
Michael Dunn13-Oct-01 7:56
sitebuilderMichael Dunn13-Oct-01 7:56 
QuestionWhere I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class? Pin
Rula Ghabbiesh11-Oct-01 5:42
Rula Ghabbiesh11-Oct-01 5:42 
AnswerRe: Where I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class? Pin
Shadi Al-Kahwaji12-Oct-01 9:05
Shadi Al-Kahwaji12-Oct-01 9:05 
AnswerRe: Where I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class? Pin
Michael Dunn12-Oct-01 16:06
sitebuilderMichael Dunn12-Oct-01 16:06 
GeneralRe: Where I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class? Pin
Rula Ghabbiesh14-Oct-01 22:00
Rula Ghabbiesh14-Oct-01 22:00 
GeneralRe: Where I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class? Pin
Michael Dunn14-Oct-01 22:05
sitebuilderMichael Dunn14-Oct-01 22:05 
GeneralPassing a COM interface to an out of process COM object Pin
Jeremy Pullicino11-Oct-01 3:33
Jeremy Pullicino11-Oct-01 3:33 
GeneralRe: Passing a COM interface to an out of process COM object Pin
John Smith11-Oct-01 5:06
John Smith11-Oct-01 5:06 

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.