@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: TODO - a short description !!!!C# Signature: [DllImport("shlwapi.dll")] extern static int AssocCreate( ref Guid clsid, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); !!!!VB Signature: Declare Function AssocCreate Lib "shlwapi.dll" (TODO) As TODO !!!!User-Defined Types: [Flags] enum ASSOCF { INIT_NOREMAPCLSID = 0x00000001, INIT_BYEXENAME = 0x00000002, OPEN_BYEXENAME = 0x00000002, INIT_DEFAULTTOSTAR = 0x00000004, INIT_DEFAULTTOFOLDER = 0x00000008, NOUSERSETTINGS = 0x00000010, NOTRUNCATE = 0x00000020, VERIFY = 0x00000040, REMAPRUNDLL = 0x00000080, NOFIXUPS = 0x00000100, IGNOREBASECLASS = 0x00000200, INIT_IGNOREUNKNOWN = 0x00000400 } enum ASSOCSTR { COMMAND = 1, EXECUTABLE, FRIENDLYDOCNAME, FRIENDLYAPPNAME, NOOPEN, SHELLNEWVALUE, DDECOMMAND, DDEIFEXEC, DDEAPPLICATION, DDETOPIC, INFOTIP, QUICKTIP, TILEINFO, CONTENTTYPE, DEFAULTICON, SHELLEXTENSION } enum ASSOCKEY { SHELLEXECCLASS = 1, APP, CLASS, BASECLASS } enum ASSOCDATA { MSIDESCRIPTOR = 1, NOACTIVATEHANDLER, QUERYCLASSSTORE, HASPERUSERASSOC, EDITFLAGS, VALUE } [Guid("c46ca590-3c3f-11d2-bee6-0000f805ca57"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] interface IQueryAssociations { void Init( [In] ASSOCF flags, [In, MarshalAs(UnmanagedType.LPWStr)] string pszAssoc, [In] UIntPtr hkProgid, [In] IntPtr hwnd); void GetString( [In] ASSOCF flags, [In] ASSOCSTR str, [In, MarshalAs(UnmanagedType.LPWStr)] string pwszExtra, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwszOut, [In, Out] ref int pcchOut); void GetKey( [In] ASSOCF flags, [In] ASSOCKEY str, [In, MarshalAs(UnmanagedType.LPWStr)] string pwszExtra, [Out] out UIntPtr phkeyOut); void GetData( [In] ASSOCF flags, [In] ASSOCDATA data, [In, MarshalAs(UnmanagedType.LPWStr)] string pwszExtra, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] out byte[] pvOut, [In, Out] ref int pcbOut); void GetEnum(); // not used actually } static Guid CLSID_QueryAssociations = new Guid("a07034fd-6caa-4954-ac3f-97a27216f98a"); static Guid IID_IQueryAssociations = new Guid("c46ca590-3c3f-11d2-bee6-0000f805ca57"); !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: try { object obj; AssocCreate( ref CLSID_QueryAssociations, ref IID_IQueryAssociations, out obj); IQueryAssociations qa = (IQueryAssociations)obj; qa.Init( ASSOCF.INIT_DEFAULTTOSTAR, ".doc", UIntPtr.Zero, IntPtr.Zero); int size = 0; qa.GetString(ASSOCF.NOTRUNCATE, ASSOCSTR.COMMAND, "print", null, ref size); StringBuilder sb = new StringBuilder(size); qa.GetString(ASSOCF.NOTRUNCATE, ASSOCSTR.COMMAND, "print", sb, ref size); Console.WriteLine(".doc is printed by : {0}", sb.ToString()); } catch(Exception e) { if((uint)Marshal.GetHRForException(e) == 0x80070483) Console.WriteLine("No command line is associated to .doc print verb."); else throw; } Documentation: AssocCreate@msdn on MSDN
Edit shlwapi.AssocCreate
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.