Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Interfaces, prefix the name with the module name and a period.
// bindstatus callback from client is free threaded
,BINDF_FREE_THREADED = 0x00010000
// client does not need to know excat size of data available
// hence the read goes directly to e.g. socket
,BINDF_DIRECT_READ = 0x00020000
// is the transaction a forms submit.
,BINDF_FORMS_SUBMIT = 0x00040000
,BINDF_GETFROMCACHE_IF_NET_FAIL = 0x00080000
// binding is from UrlMoniker
,BINDF_FROMURLMON = 0x00100000
,BINDF_FWD_BACK = 0x00200000
// Note:
// the highest byte 0x??000000 is used internally
// see other documentation
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4)]
public struct SECURITY_ATTRIBUTES
{
public uint nLength;
public uint lpSecurityDescriptor;
public int bInheritHandle;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4)]
public struct BINDINFO
{
public uint cbSize;
[MarshalAs(UnmanagedType.LPWStr)]
public string szExtraInfo;
public STGMEDIUM stgmedData;
public uint grfBindInfoF;
public BINDVERB dwBindVerb;
[MarshalAs(UnmanagedType.LPWStr)]
public string szCustomVerb;
public uint cbstgmedData;
public uint dwOptions;
public uint dwOptionsFlags;
public uint dwCodePage;
public SECURITY_ATTRIBUTES securityAttributes;
public Guid iid;
[MarshalAs(UnmanagedType.IUnknown)]
public object punk;
public uint dwReserved;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4), ComConversionLoss]
public struct FORMATETC
{
public uint cfFormat;
[ComConversionLoss]
public IntPtr ptd;
public uint dwAspect;
public int lindex;
public uint tymed;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4), ComConversionLoss]
public struct STGMEDIUM
{
public uint tymed;
[ComConversionLoss]
public IntPtr data;
[MarshalAs(UnmanagedType.IUnknown)]
public object pUnkForRelease;
}
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.IO;
using System.ComponentModel;
using NIPL.Common.Log;
using System.Threading;
CONNECT_E_FIRST = 0x80040200,
CONNECT_E_NOCONNECTION, // there is no connection for this connection id
CONNECT_E_ADVISELIMIT, // this implementation's limit for advisory connections has been reached
CONNECT_E_CANNOTCONNECT, // connection attempt failed
CONNECT_E_OVERRIDDEN, // must use a derived interface to connect
// DllRegisterServer/DllUnregisterServer errors
SELFREG_E_TYPELIB = 0x80040200, // failed to register/unregister type library
SELFREG_E_CLASS, // failed to register/unregister class
}
/// <summary>
/// file downloader class
/// </summary>
[ClassInterface(ClassInterfaceType.None)]
public class Downloader : IBindStatusCallback,IDisposable
{
public Downloader()
{
//
// TODO: Add constructor logic here
//
}
public delegate void DownloadEvent(string file);
public delegate void DownloadAborted(string file,long Errorcode,string Message);
public delegate void DownloadProgress(string file,long ReceivedBytes,long TotalBytes);
public event DownloadEvent OnDownloadStarted;
public event DownloadEvent OnDownloadComplete;
public event DownloadAborted OnDownloadAborted;
public event DownloadProgress OnDownloadProgress;
private IBinding mobjBinding;
private bool IsAborted=false;
public string LocalPath;
public string SourcePath;
#region IDisposable Members
//finalizer
~Downloader()
{
Dispose(false);
}
//disposer
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// The URLMON library contains this function, URLDownloadToFile, which is a way
/// to download files without user prompts.
/// </summary>
/// <param name="pCaller">Pointer to caller object (AX).</param>
/// <param name="szURL">String of the URL.</param>
/// <param name="szFileName">String of the destination filename/path.</param>
/// <param name="dwReserved">[reserved].</param>
/// <param name="lpfnCB">A callback function to monitor progress or abort.</param>
/// <returns>throws exception if not success</returns>
[DllImport("urlmon.dll", CharSet=CharSet.Auto,SetLastError=true, PreserveSig=false)]
public static extern void URLDownloadToFile(
[MarshalAs(UnmanagedType.IUnknown)] object pAxCaller,
[MarshalAs(UnmanagedType.LPWStr)] string szURL,
[MarshalAs(UnmanagedType.LPWStr)] string szFileName,
[MarshalAs(UnmanagedType.U4)] uint dwReserved,
[MarshalAs(UnmanagedType.Interface)] IBindStatusCallback lpfnCB);
public void Download()
{
try
{
IsAborted=false;
if( mobjBinding ==null)
{
string destdir=Path.GetDirectoryName(this.LocalPath);
if(!Directory.Exists(destdir))
Directory.CreateDirectory(destdir);
URLDownloadToFile(IntPtr.Zero, SourcePath , LocalPath ,0,(IBindStatusCallback)this);//use 0x10 for new download