// Create a new instance of IBindCtx IBindCtx bindCtx = new BindCtx(); // Create a moniker for the object to be bound IMoniker moniker = CreateMoniker(); // Use the moniker and the bind context to bind to the object Object obj = null; moniker.BindToObject(bindCtx, null, typeof(Object).GUID, out obj);
// Create a new instance of IBindCtx IBindCtx bindCtx = new BindCtx(); // Create a moniker for the object to be bound IMoniker moniker = CreateMoniker(); // Add a binding option to the bind context BIND_OPTS bindingOptions = new BIND_OPTS(); bindingOptions.cbStruct = Marshal.SizeOfBoth of these examples are part of a larger library of COM interfaces and services for creating and managing distributed applications, called the Component Object Model (COM).(); bindingOptions.grfMode = STGM_READ; bindCtx.SetBindOptions(ref bindingOptions); // Use the moniker and the bind context to bind to the object Object obj = null; moniker.BindToObject(bindCtx, null, typeof(Object).GUID, out obj);