Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
DsBugWO.cs
Package: capsample_src.zip [view]
Upload User: wuming6209
Upload Date: 2013-06-06
Package Size: 161k
Code Size: 1k
Category:
Video Capture
Development Platform:
Visual C++
- /******************************************************
- DirectShow .NET
- netmaster@swissonline.ch
- *******************************************************/
- // WORKAROUND FOR DS BUGs
- using System;
- using System.Text;
- using System.Runtime.InteropServices;
- namespace DShowNET
- {
- public class DsBugWO
- {
- /*
- works:
- CoCreateInstance( CLSID_CaptureGraphBuilder2, ..., IID_ICaptureGraphBuilder2, ...);
- doesn't (E_NOTIMPL):
- CoCreateInstance( CLSID_CaptureGraphBuilder2, ..., IID_IUnknown, ...);
- thus .NET 'Activator.CreateInstance' fails
- */
- public static object CreateDsInstance( ref Guid clsid, ref Guid riid )
- {
- IntPtr ptrIf;
- int hr = CoCreateInstance( ref clsid, IntPtr.Zero, CLSCTX.Inproc, ref riid, out ptrIf );
- if( (hr != 0) || (ptrIf == IntPtr.Zero) )
- Marshal.ThrowExceptionForHR( hr );
- Guid iu = new Guid( "00000000-0000-0000-C000-000000000046" );
- IntPtr ptrXX;
- hr = Marshal.QueryInterface( ptrIf, ref iu, out ptrXX );
- object ooo = System.Runtime.Remoting.Services.EnterpriseServicesHelper.WrapIUnknownWithComObject( ptrIf );
- int ct = Marshal.Release( ptrIf );
- return ooo;
- }
- [DllImport("ole32.dll") ]
- private static extern int CoCreateInstance( ref Guid clsid, IntPtr pUnkOuter, CLSCTX dwClsContext, ref Guid iid, out IntPtr ptrIf );
- }
- [Flags]
- internal enum CLSCTX
- {
- Inproc = 0x03,
- Server = 0x15,
- All = 0x17,
- }
- } // namespace DShowNET