Example #1
0
        /// <summary>
        /// Check Format related functions
        /// </summary>
        void TestFormats()
        {
            int  hr;
            Guid pFormat;

            // Query to see what the preferred time format is
            hr = m_ims.QueryPreferredFormat(out pFormat);
            Marshal.ThrowExceptionForHR(hr);

            // Is the preferred format supported?  Certainly hope so.
            hr = m_ims.IsFormatSupported(pFormat);
            Marshal.ThrowExceptionForHR(hr);

            // Might return and S_ code
            Debug.Assert(hr == 0);

            // Read the current time format
            hr = m_ims.GetTimeFormat(out pFormat);
            Marshal.ThrowExceptionForHR(hr);

            // See if the current format is the one we are using.
            // Better be.
            hr = m_ims.IsUsingTimeFormat(pFormat);
            Marshal.ThrowExceptionForHR(hr);

            // Try setting the format to the current value (the
            // only one we are sure is supported).
            hr = m_ims.SetTimeFormat(pFormat);
            Marshal.ThrowExceptionForHR(hr);
        }