Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QuickTime 7 (7.0.2.70) ActiveX control, how to subscribe for QTEvents



Bendight,

Try something like this right after you create the control:


<code> void MyClass::AddEventListeners() { HRESULT hr = S_OK;

	CComPtr<IQTControl>			spQTControl;
	CComPtr<IQTMovie>			spQTMovie;
	CComPtr<IQTEventListeners>	spEventListeners;

	// Get interface pointer to control
	hr =  m_ax.QueryControl(&spQTControl) )

	// Get interface pointer to movie
	hr = spQTControl->get_Movie(&spQTMovie));

	if (!spQTMovie)
		return;

	// Get interface pointer to event listeners collection
	hr = spQTMovie->get_EventListeners(&spEventListeners );
	if (! spEventListeners)
		return;

	spEventListeners->RemoveAll();


spEventListeners->Add(qtEventClassTemporal, qtEventTimeWillChange); spEventListeners->Add(qtEventClassAudio, qtEventAudioVolumeDidChange);

	spEventListeners->Add(qtEventClassStateChange, qtEventRateWillChange);

spEventListeners->Add(qtEventClassApplicationRequest, qtEventShowStatusStringRequest);
return;
}
void __stdcall MyClass::SinkQTEvent(long EventClass, long EventID, long Phase, IQTEventObject* EventObject, VARIANT_BOOL* Cancel)
{
float rate;
long time, volume;


	CComPtr<IQTEventObject> event = EventObject;

	switch (EventID)
	{

case qtEventShowStatusStringRequest:
{
enum {
kStatusStringIsURLLink = 1L << 1,
kStatusStringIsStreamingStatus = 1L << 2,
kStatusHasCodeNumber = 1L << 3, /* high 16 bits of stringTypeFlags is error code number*/
kStatusIsError = 1L << 4
};


			VARIANT				msgString,
								msgFlags,
								msgCode;
			TCHAR* pStrg=NULL;

			event->GetParam(qtEventParamStatusString, &msgString);
			
			VariantInit(&msgFlags);
			event->GetParam((QTEventObjectParametersEnum)'flag', &vTemp);
			if ( FAILED(VariantChangeType(&msgFlags, &vTemp, 0, VT_I4)) )
				break;

			VariantInit(&msgCode);
			event->GetParam(qtEventParamStatusCode, &vTemp);
			if ( FAILED(VariantChangeType(&msgCode, &vTemp, 0, VT_I4)) )
				break;

			theEvent.retValue = msgCode.lVal;
			if ( V_VT(&msgString) == VT_BSTR )
				pStrg  = OLE2T(msgString.bstrVal);
		}
	}
}

// and you will want SinkQTEvent declared in the header for the class like this
BEGIN_SINK_MAP(CMainWindow)
SINK_ENTRY_EX(ID_CHILD_CONTROL, DIID__IQTControlEvents, 1, SinkQTEvent)
END_SINK_MAP()


void __stdcall SinkQTEvent(long EventClass, long EventID, long Phase, IQTEventObject* EventObject, VARIANT_BOOL* Cancel);

</code>

Hope this helps. I did not put in much error checking and I left out how to handle the other events (I can show you that if you wish). I believe there is some documentation coming soon but I just do not know when.

Tom McHale
QuickTime Engineering

On Aug 16, 2005, at 7:56 AM, email@hidden wrote:

Hello everyone

over the past weeks I've been experimenting with the new QuckTime ActiveX control, and I realize that it's still being changed quite a bit, and no documentation seems to be available yet. Nevertheless, I find it very practical as the simpler functionality is intuitive to use, and with a little QuickTime api knowldege, many other aspects of the control can be guessed at as well.

What I haven't figured out, however, is how I can make the control fire QTEvent notifications. And I suspect that QTEvent is the only way to get more precise notifications about what the control is doing.
With the version 7.0.2.70 update (public preview 3, I believe), for example, the control doesn't seem to be sending messages like "Buffering..." as StatusUpdate events anymore. So if I'd like "Buffering.." back, I'd probably have to subscribe to some event interface now...


I've tried subscribing to events in the following way:

axQTControl.QuickTime.EventListeners.Add(
    QTOLibrary.QTEventClassesEnum.qtEventClassStateChange,
    QTOLibrary.QTEventIDsEnum.qtEventLoadStateDidChange,
    1,    //what flags are needed here?
    null);    //probably optional, right?

I've tried registring for events with other interfaces (not just control.QuickTime) as well, and I've called EventListeners.Add() with other argument combinations - all without success.

My question is therefore: Does anyone have more detailed knowledge on how to get QTEvent events out of the new QuickTime control?

Besides the fact that I'm not entirely sure about which combinations of QTEventClassesEnum and QTEventIDsEnum are allowed, I have no clue as to what values tha Flags prameter (3rd argument of the EventListeners.Add() method) should be. The fourth argument I'd expect to be some subscriber reference.

Any help would be greatly apprecieated, thanks.


Baenz


_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.