本文整理汇总了C#中IMoniker.GetDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C# IMoniker.GetDisplayName方法的具体用法?C# IMoniker.GetDisplayName怎么用?C# IMoniker.GetDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMoniker
的用法示例。
在下文中一共展示了IMoniker.GetDisplayName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Download
/// <summary>
/// Return S_OK (0) so that IE will stop to download the file itself.
/// Else the default download user interface is used.
/// </summary>
public int Download(IMoniker pmk, IBindCtx pbc, uint dwBindVerb, int grfBINDF,
IntPtr pBindInfo, string pszHeaders, string pszRedir, uint uiCP)
{
// Get the display name of the pointer to an IMoniker interface that specifies
// the object to be downloaded.
string name = string.Empty;
pmk.GetDisplayName(pbc, null, out name);
if (!string.IsNullOrEmpty(name))
{
Uri url = null;
bool result = Uri.TryCreate(name, UriKind.Absolute, out url);
if (result)
{
MessageBox.Show(url.ToString());
//pmk.BindToStorage(pbc,null,);
//// Launch CSWebDownloader.exe to download the file.
//FileInfo assemblyFile =
// new FileInfo(Assembly.GetExecutingAssembly().Location);
//ProcessStartInfo start = new ProcessStartInfo
//{
// Arguments = name,
// FileName =
// string.Format("{0}\\CSWebDownloader.exe", assemblyFile.DirectoryName)
//};
//Process.Start(start);
return 0;
}
}
return 1;
}
示例2: GetMonikerString
// Get moniker string of the moniker
private string GetMonikerString(IMoniker moniker)
{
string str;
moniker.GetDisplayName(null, null, out str);
return str;
}
示例3: getMonikerString
protected string getMonikerString(IMoniker moniker)
#endif
#endif
{
string s;
moniker.GetDisplayName( null, null, out s );
return( s );
}
示例4: Download
/// <summary>
/// Return S_OK (0) so that IE will stop to download the file itself.
/// Else the default download user interface is used.
/// </summary>
/// <returns>Return S_OK (0) or 1.</returns>
public int Download(IMoniker pmk, IBindCtx pbc, uint dwBindVerb, int grfBINDF, IntPtr pBindInfo,
string pszHeaders, string pszRedir, uint uiCP)
{
string name;
pmk.GetDisplayName(pbc, null, out name);
if (!string.IsNullOrEmpty(name))
{
Uri url;
if (Uri.TryCreate(name, UriKind.Absolute, out url))
{
Debug.WriteLine("DownloadManager: initial URL is: " + url);
if (FileDownloading != null)
{
FileDownloading(this, new FileDownloadEventArgs(url));
////DownloadMod(url.ToString());
}
return WebBrowserEx.Constants.S_OK;
}
}
return 1;
}
示例5: GetMonikerString
/// <summary>
/// Gets the moniker string for a specific moniker
/// </summary>
/// <param name="moniker">Moniker to retrieve the moniker string of</param>
/// <returns>Moniker string</returns>
private static string GetMonikerString(IMoniker moniker)
{
// Declare variables
string result = "";
// Get the display name of the moniker
moniker.GetDisplayName(null, null, out result);
// Return result
return result;
}
示例6: MonikerToString
public static string MonikerToString(IMoniker moniker, uint codepage, out string url)
{
// Create binding context that will be needed to get the url from the moniker
IBindCtx bindCtx;
int hr = Ole32.CreateBindCtx(0, out bindCtx);
if (hr != HRESULT.S_OK)
throw new COMException("Error creating binding context", hr);
// Get the url of the moniker
string name;
moniker.GetDisplayName(bindCtx, null, out name);
url = name;
// Get a stream to the content of the url
IStream stream;
ComHelper.Chk(UrlMon.URLOpenBlockingStream(IntPtr.Zero, name, out stream, 0, null));
// Read the contents of the url, which should be the html to an email message
using (ComStream comStream = new ComStream(stream, false))
{
using (StreamReader sr = new StreamReader(comStream, Encoding.GetEncoding((int)codepage)))
{
return sr.ReadToEnd();
}
}
}
示例7: GetMonikerDisplayName
public static string GetMonikerDisplayName(IMoniker pmk)
{
string strDisplayName;
IBindCtx bindCtx = CreateBindCtx(0);
pmk.GetDisplayName(bindCtx, null, out strDisplayName);
Marshal.ReleaseComObject(bindCtx);
return strDisplayName;
}
示例8: SelectedFilter
/// <summary>
/// This method is for internal purpose. Don't call it directly.
/// </summary>
/// <param name="moniker"></param>
/// <returns></returns>
public int SelectedFilter(IMoniker moniker)
{
if (moniker == null)
throw new ArgumentNullException("moniker");
int retval = S_OK;
string monikerDisplayName = null;
Guid filterClsid;
// Get the moniker's display name.
// DirectShow filter have this form: @device:sw:FilterCategory\CLSID
moniker.GetDisplayName(null, null, out monikerDisplayName);
Debug.WriteLine(string.Format("\r\nBlackListManager.SelectedFilter:\r\nMoniker: {0}", monikerDisplayName));
// Did the display name normally composed ?
int i = monikerDisplayName.LastIndexOf('\\');
if (i != -1)
{
// Yes, tring to get the CLSID
if (GuidTryParse(monikerDisplayName.Substring(i + 1), out filterClsid))
{
// Display informations about this filter
this.DisplayDebugInformation(moniker, filterClsid);
// Test if the filter is black-listed
if (this.blackList.Contains(filterClsid))
{
Debug.WriteLine("WARNING: This filter is black-listed! Rejecting it.");
// The filter is black listed. Rejecting it.
retval = E_FAIL;
}
}
}
return retval;
}