Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

OleCreate (ole32)
 
.
Summary
Invokes a new property frame.

C# Signature:

[DllImport("oleaut32.dll", PreserveSig = false)]
static extern void OleCreatePropertyFrame(IntPtr hwndOwner, int x, int y,
    [MarshalAs(UnmanagedType.LPWStr)] string lpszCaption,
    int cObjects, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4, ArraySubType = UnmanagedType.IUnknown)] object[] lplpUnk,
    int cPages, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,
    int lcid, int dwReserved, int lpvReserved);

VB Signature:

Declare Function OleCreatePropertyFrame Lib "ole32.dll" (TODO) As TODO

VB.Net Signature:

    Declare Function OleCreatePropertyFrame Lib "oleaut32" _
    (ByVal hwndOwner As IntPtr, _
    ByVal x As Int32, _
    ByVal y As Int32, _
    <MarshalAs(UnmanagedType.LPWStr)> _
    ByVal lpszCaption As String, _
    ByVal cObjects As Int32, _
    <MarshalAs(UnmanagedType.Interface, ArraySubType:=UnmanagedType.IUnknown)> _
    ByRef ppUnk As Object, _
    ByVal cPages As Int32, _
    ByVal pPageClsID As Int32, _
    ByVal lcid As Int32, _
    ByVal dwReserved As Int32, _
    ByVal pvReserved As IntPtr) As Integer

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

This should be under oleaut32.dll!

Tips & Tricks:

Please add some!

Sample Code:

// complete example at http://www.codeproject.com/Articles/34663/DirectShow-Examples-for-Using-SampleGrabber-for-Gr

using System;

using System.Runtime.InteropServices;

using System.Windows.Forms;

using DirectShowLib;

namespace Utilities.DirectShow.Capture

{

    /// <summary>
    ///  Property pages for a DirectShow filter (e.g. hardware device). These
    ///  property pages do not support persisting their settings.
    /// </summary>
    public class DirectShowPropertyPage : PropertyPage
    {
        /// <summary> COM ISpecifyPropertyPages interface </summary>
        protected ISpecifyPropertyPages specifyPropertyPages;

        /// <summary> Constructor </summary>
        public DirectShowPropertyPage(string name, ISpecifyPropertyPages specifyPropertyPages)
        {
            Name = name;
            SupportsPersisting = false;
            this.specifyPropertyPages = specifyPropertyPages;
        }

        /// <summary>
        ///  Show the property page. Some property pages cannot be displayed
        ///  while previewing and/or capturing.
        /// </summary>
        public override void Show(Control owner)
        {
            DsCAUUID cauuid = new DsCAUUID();
            try
            {
                int hr = specifyPropertyPages.GetPages( out cauuid );
                if ( hr != 0 ) Marshal.ThrowExceptionForHR( hr );

        object[] o = new object[] { specifyPropertyPages };
        Guid[] guidarray = cauuid.ToGuidArray();
        int nelements = guidarray.Length;

        hr = OleCreatePropertyFrame(owner.Handle, 0, 0, Name, o.Length,
            o, nelements, guidarray, 0, 0, 0);
            }
            finally
            {
                if( cauuid.pElems != IntPtr.Zero )
                    Marshal.FreeCoTaskMem( cauuid.pElems );
            }
        }

        /// <summary> Release unmanaged resources </summary>
        public new void Dispose()
        {
            if ( specifyPropertyPages != null )
                Marshal.ReleaseComObject( specifyPropertyPages ); specifyPropertyPages = null;
        }

    [DllImport("oleaut32.dll", CharSet=CharSet.Unicode, ExactSpelling=true) ]
    static extern int OleCreatePropertyFrame(IntPtr hwndOwner,
        int x,
        int y,
        [MarshalAs(UnmanagedType.LPWStr)] string lpszCaption,
        int cObjects,
        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4, ArraySubType = UnmanagedType.IUnknown)] object[] lplpUnk,
        int cPages,
        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,
        int lcid,
        int dwReserved,
        int lpvReserved);

    }

}

Documentation

Changes:

7/6/2012 Dan Woerner : Changed olepro32.dll to oleaut32.dll because olepro32 doesn't work for x64, also changed the uint/UINT32/(and IntPtr reserved) to int because they are easier to deal with

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions