本文整理汇总了C#中IMoniker.ComposeWith方法的典型用法代码示例。如果您正苦于以下问题:C# IMoniker.ComposeWith方法的具体用法?C# IMoniker.ComposeWith怎么用?C# IMoniker.ComposeWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMoniker
的用法示例。
在下文中一共展示了IMoniker.ComposeWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EhFileMonikerChanged
private void EhFileMonikerChanged(IMoniker fileMoniker)
{
if (null == _document)
return;
// see Brockschmidt, Inside Ole 2nd ed., p.998
// TODO we must pimp up this function
RunningObjectTableHelper.ROTUnregister(ref _documentMonikerRotCookie);
_documentMoniker = null;
if (null != fileMoniker)
{
IMoniker itemMoniker;
Ole32Func.CreateItemMoniker("!", DataObjectHelper.NormalStringToMonikerNameString(_document.Name), out itemMoniker);
IMoniker compositeMoniker;
if (null != itemMoniker)
{
fileMoniker.ComposeWith(itemMoniker, false, out compositeMoniker);
if (null != compositeMoniker)
{
_documentMoniker = compositeMoniker;
RunningObjectTableHelper.ROTRegisterAsRunning(_documentMoniker, this, ref _documentMonikerRotCookie, typeof(IOleObject));
}
}
}
SendAdvise_Renamed();
}
示例2: EhCurrentProjectFileNameChanged
private void EhCurrentProjectFileNameChanged(string fileName)
{
// see Brockschmidt, Inside Ole 2nd ed., page 996
// make sure that if we have a valid file name, then the ComManager should be Active in order that this Com object is made public
if (!string.IsNullOrEmpty(fileName) && !_comManager.IsActive)
{
ComDebug.ReportInfo("{0}.EhCurrentProjectFileNameChanged StartLocalServer because we have a valid file name. FileName: {1}", this.GetType().Name, fileName);
_comManager.StartLocalServer();
}
ComDebug.ReportInfo("{0}.EhCurrentProjectFileNameChanged", this.GetType().Name);
RunningObjectTableHelper.ROTUnregister(ref _fileWithWildCardItemMonikerRotCookie);
_fileWithWildCardItemMoniker = null;
RunningObjectTableHelper.ROTUnregister(ref _fileMonikerRotCookie);
_fileMoniker = null;
if (!string.IsNullOrEmpty(fileName))
{
Ole32Func.CreateFileMoniker(fileName, out _fileMoniker);
if (null != _fileMoniker)
{
RunningObjectTableHelper.ROTRegisterAsRunning(_fileMoniker, this, ref _fileMonikerRotCookie, typeof(IPersistFile));
// Notify all other item Com objects of the new _fileMoniker
if (null != FileMonikerChanged)
FileMonikerChanged(_fileMoniker);
// now register also a file moniker with a wild card item, that handles all items that are not open in the moment
IMoniker wildCardItemMoniker;
Ole32Func.CreateItemMoniker("!", "\\", out wildCardItemMoniker);
if (null != wildCardItemMoniker)
{
_fileMoniker.ComposeWith(wildCardItemMoniker, false, out _fileWithWildCardItemMoniker);
RunningObjectTableHelper.ROTRegisterAsRunning(_fileWithWildCardItemMoniker, this, ref _fileWithWildCardItemMonikerRotCookie, typeof(IOleItemContainer));
}
}
}
}