Group:  English: Entertainment ยป microsoft.public.windowsmedia.sdk
Thread: OleCreatePropertyFrame- how to write in c#

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

OleCreatePropertyFrame- how to write in c#
fatihshen <fatihsen23[ at ]gmail.com> 05.07.2007 18:21:42
Hi,

Currently I am developing an encoder application using Windows Media
Encoder(WMEncoder). I am trying to display the property page of the
camera. There is an existing code written in c++ in which
OleCreatePropertyFrame function is used.

The c++ codes looks like this.

// Retrieve the plug-in object.
if ( SUCCEEDED( hr ) )
{
hr = pVidSrc->GetSourcePlugin( &pPlugin );
}

// Call QueryInterface to verify whether the plug-in supports
// property pages. If it does, retrieve a pointer to the
// ISpecifyPropertyPages interface, and fill an array of GUID
// values in which each GUID specifies the CLSID of each property
// page that can be displayed for this object.
if ( SUCCEEDED( hr ) )
{
hr = pPlugin->QueryInterface(IID_ISpecifyPropertyPages,
(LPVOID*)&pPages);
}

if ( SUCCEEDED( hr ) )
{
hr = pPages->GetPages( &uuid );
}

// Invoke a dialog box to display.
if ( SUCCEEDED( hr ) )
{
hr = OleCreatePropertyFrame
(
m_hWnd, // You must create the parent window.
200, // Horizontal position for the dialog box.
200, // Vertical position for the dialog box.
CComBSTR("name"), // String used for the dialog box
caption.
1, // Number of pointers passed in pPlugin.
&pPlugin, // Pointer to the plug-in.
uuid.cElems, // Number of property pages.
uuid.pElems, // Array of property page CLSIDs.
LOCALE_USER_DEFAULT, // Locale ID for the dialog box.
0, // Reserved.
NULL // Reserved.
);
}

I am wondering whether there is a c# solution for this. I would be
very glad if someone could help me. Thanks.

Fatih

Re: OleCreatePropertyFrame- how to write in c#
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 05.07.2007 20:18:48
From: "fatihshen"

[Quoted Text]
> Currently I am developing an encoder application using
> Windows Media Encoder(WMEncoder). I am trying to display
> the property page of the camera. There is an existing
> code written in c++ in which OleCreatePropertyFrame
> function is used.

Just use P/Invoke InterOp to call the native
OLE32.DLL!OleCreatePropertyFrame(), which is very easy to
marshal since it doesn't expect any structure. If your UI
uses System.Windows.Forms, you shouldn't have any problem
getting an HWND from any Control, since it implements
IWin32Window.Handle.



--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Re: OleCreatePropertyFrame- how to write in c#
fatihshen <fatihsen23[ at ]gmail.com> 06.07.2007 13:40:48
On Jul 5, 4:18 pm, "Alessandro Angeli" <nob...[ at ]nowhere.in.the.net>
wrote:
[Quoted Text]
> From: "fatihshen"
>
> > Currently I am developing an encoder application using
> > Windows Media Encoder(WMEncoder). I am trying to display
> > the property page of the camera. There is an existing
> > code written in c++ in which OleCreatePropertyFrame
> > function is used.
>
> Just use P/Invoke InterOp to call the native
> OLE32.DLL!OleCreatePropertyFrame(), which is very easy to
> marshal since it doesn't expect any structure. If your UI
> uses System.Windows.Forms, you shouldn't have any problem
> getting an HWND from any Control, since it implements
> IWin32Window.Handle.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> //http://www.riseoftheants.com/mmx/faq.htm

Hi Alessandro,

I looked ole32 but could not find OleCreatePropertyFrame() function.
Do you mean olepro32.dll?

I have found somewhere this implemented function:

[DllImport("olepro32.dll")]
public static extern int OleCreatePropertyFrame(
IntPtr hwndOwner,
[MarshalAs(UnmanagedType.U4)] int x,
[MarshalAs(UnmanagedType.U4)] int y,
[MarshalAs(UnmanagedType.LPWStr)] string lpszCaption,
[MarshalAs(UnmanagedType.U4)] int cObjects,
[MarshalAs(UnmanagedType.LPArray,
ArraySubType=UnmanagedType.IUnknown)]
object lplpUnk,
[MarshalAs(UnmanagedType.U4)] int cPages,
[MarshalAs(UnmanagedType.LPArray,
ArraySubType=UnmanagedType.Struct)]
Guid[] lpPageClsID,
Guid lcid,
[MarshalAs(UnmanagedType.U4)] int dwReserved,
IntPtr lpvReserved);

Now, I have trouble in initializing variables and calling this
function. Could you help me please?

Thanks.

Fatih

Re: OleCreatePropertyFrame- how to write in c#
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 06.07.2007 18:35:57
From: "fatihshen"

[Quoted Text]
> I looked ole32 but could not find
> OleCreatePropertyFrame() function. Do you mean
> olepro32.dll?

Yes, sorry. I should have looked it up instead of trusting
my memory.

> [MarshalAs(UnmanagedType.LPArray,
> ArraySubType=UnmanagedType.Struct)]
> Guid[] lpPageClsID,

I think this should be declared just as Guid[], without the
MashalAsAttribute to marshal it correctly.

> Now, I have trouble in initializing variables and calling
> this function. Could you help me please?

What problems do you have?

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net