@@ -27,26 +27,6 @@ public static IntPtr CreateInstanceByClsid<T>(Guid clsid)
2727 return pInterface ;
2828 }
2929
30- public static IntPtr CreateInstanceByProgId < T > ( string progId )
31- {
32- Guid clsid = ClsidFromProgId ( progId ) ;
33- IntPtr pInterface = CreateInstanceByClsid < T > ( clsid ) ;
34-
35- return pInterface ;
36- }
37-
38- private static Guid ClsidFromProgId ( string progId )
39- {
40- Guid clsid ;
41-
42- if ( ! Guid . TryParseExact ( progId , "B" , out clsid ) )
43- {
44- HResult . Check ( NativeMethods . CLSIDFromProgID ( progId , out clsid ) ) ;
45- }
46-
47- return clsid ;
48- }
49-
5030 public static bool TryCreateComObject < T > ( string progId , string serverName , out T obj ) where T : class
5131 {
5232 Type type ;
@@ -92,14 +72,6 @@ public static IntPtr QueryInterfaceNoThrow<T>(IntPtr pUnknown)
9272 return result == ComErrorCode . S_OK ? pInterface : IntPtr . Zero ;
9373 }
9474
95- public static T GetMethodDelegate < T > ( IntPtr pInterface , int methodIndex ) where T : class
96- {
97- var pVTable = Marshal . ReadIntPtr ( pInterface ) ;
98- var pMethod = Marshal . ReadIntPtr ( pVTable + methodIndex * IntPtr . Size ) ;
99-
100- return Marshal . GetDelegateForFunctionPointer ( pMethod , typeof ( T ) ) as T ;
101- }
102-
10375 public static void ReleaseAndEmpty ( ref IntPtr pUnk )
10476 {
10577 if ( pUnk != IntPtr . Zero )
@@ -121,12 +93,6 @@ public static extern uint CoCreateInstance(
12193 [ In ] ref Guid iid ,
12294 [ Out ] out IntPtr pInterface
12395 ) ;
124-
125- [ DllImport ( "ole32.dll" , ExactSpelling = true ) ]
126- public static extern uint CLSIDFromProgID (
127- [ In ] [ MarshalAs ( UnmanagedType . LPWStr ) ] string progId ,
128- [ Out ] out Guid clsid
129- ) ;
13096 }
13197
13298 #endregion
0 commit comments