Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Windows Forms » Downloads
 
Add your own
alternative version
Go to top

C# WinForms Application Full Integration with HTMLHelp ( .chm ) - Help Topics, Context Sensitive Help, and Tooltips

, 4 May 2011
Use HTMLHelp (.chm) to display help topics, context sensitive help and tooltips in C# Winform application
using System;
using System.Security;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.OLE.Interop;


namespace WinHelpLib
{

    /// <summary>
    /// ITStorage control data struct
    /// </summary>
    [ComVisible(false), StructLayout(LayoutKind.Sequential)]
    struct ITS_Control_Data
    {
        /// <summary>
        /// Controldata flag
        /// </summary>
        public UInt32 cdwControlData;
        /// <summary>
        /// Controldata flag
        /// </summary>
        public UInt32 adwControlData;
    }

    enum ECompactionLev
    {
        COMPACT_DATA = 0,
        COMPACT_DATA_AND_PATH
    }

    /// <summary>
    /// .NET interface wrapper for InfoTech interface for ITStorage COM object
    /// </summary>
    [ComImport,
    Guid("88CC31DE-27AB-11D0-9DF9-00A0C922E6EC"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
    SuppressUnmanagedCodeSecurity]
    interface ITStorage
    {
        [return: MarshalAs(UnmanagedType.Interface)]
        IStorage StgCreateDocfile([In,
                MarshalAs(UnmanagedType.BStr)] string pwcsName,
                int grfMode,
                int reserved);

        [return: MarshalAs(UnmanagedType.Interface)]
        IStorage StgCreateDocfileOnILockBytes(ILockBytes plkbyt,
                                    int grfMode, int reserved);

        int StgIsStorageFile([In,
             MarshalAs(UnmanagedType.BStr)] string pwcsName);
        int StgIsStorageILockBytes(ILockBytes plkbyt);

        [return: MarshalAs(UnmanagedType.Interface)]
        IStorage StgOpenStorage([In,
                    MarshalAs(UnmanagedType.BStr)] string pwcsName,
                    IntPtr pstgPriority,
                    [In, MarshalAs(UnmanagedType.U4)] int grfMode,
                    IntPtr snbExclude,
                    [In, MarshalAs(UnmanagedType.U4)] int reserved);

        [return: MarshalAs(UnmanagedType.Interface)]
        IStorage StgOpenStorageOnILockBytes(ILockBytes plkbyt,
                    IStorage pStgPriority,
                    int grfMode,
                    IntPtr snbExclude,
                    int reserved);

        int StgSetTimes([In, MarshalAs(UnmanagedType.BStr)] string lpszName,
                        Microsoft.VisualStudio.OLE.Interop.FILETIME pctime,
                        Microsoft.VisualStudio.OLE.Interop.FILETIME patime,
                        Microsoft.VisualStudio.OLE.Interop.FILETIME pmtime);
        int SetControlData(ITS_Control_Data pControlData);
        int DefaultControlData(ITS_Control_Data ppControlData);
        int Compact([In, MarshalAs(UnmanagedType.BStr)] string pwcsName,
                         ECompactionLev iLev);
    }


    // Declare ITStorageCoClass as a COM coclass:
    [ComImport, Guid("5d02926a-212e-11d0-9df9-00a0c922e6ec")]
    class ITStorageCoClass   // Cannot have a base class or interface list here.
    {
        // Cannot have any members here 
        // NOTE that the C# compiler will add a default constructor
        // for you (no parameters).
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Veselin Tenev
Software Developer (Senior)
United Kingdom United Kingdom
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 5 May 2011
Article Copyright 2011 by Veselin Tenev
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid