Click here to Skip to main content
15,896,207 members
Articles / Desktop Programming / Windows Forms

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

Rate me:
Please Sign up or sign in to vote.
4.67/5 (12 votes)
4 May 2011CPOL5 min read 64.3K   2.2K   48  
Use HTMLHelp (.chm) to display help topics, context sensitive help and tooltips in C# Winform application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.OLE.Interop;

namespace WinHelpLib
{

    enum STGTY
    {
        STGTY_STORAGE = 1,
        STGTY_STREAM = 2,
        STGTY_LOCKBYTES = 3,
        STGTY_PROPERTY = 4
    };

    enum STREAM_SEEK
    {
        STREAM_SEEK_SET = 0,
        STREAM_SEEK_CUR = 1,
        STREAM_SEEK_END = 2
    };


    enum STATFLAG
    {
        STATFLAG_DEFAULT = 0,
        STATFLAG_NONAME = 1,
        STATFLAG_NOOPEN = 2
    };

    class IDocFileEx
    {
        public const int S_OK = 0x00000000;
        public const int S_FALSE = 0x00000001;

        public const int STGM_READ = 0x00000000;
        public const int STGM_WRITE = 0x00000001;
        public const int STGM_READWRITE = 0x00000002;
        public const int STGM_SHARE_DENY_NONE = 0x00000040;
        public const int STGM_SHARE_DENY_READ = 0x00000030;
        public const int STGM_SHARE_DENY_WRITE = 0x00000020;
        public const int STGM_SHARE_EXCLUSIVE = 0x00000010;
        public const int STGM_PRIORITY = 0x00040000;
        public const int STGM_CREATE = 0x00001000;
        public const int STGM_CONVERT = 0x00020000;
        public const int STGM_FAILIFTHERE = 0x00000000;
        public const int STGM_DIRECT = 0x00000000;
        public const int STGM_TRANSACTED = 0x00010000;
        public const int STGM_NOSCRATCH = 0x00100000;
        public const int STGM_NOSNAPSHOT = 0x00200000;
        public const int STGM_SIMPLE = 0x08000000;
        public const int STGM_DIRECT_SWMR = 0x00400000;
        public const int STGM_DELETEONRELEASE = 0x04000000;


        public static IStorageEx Open(string sName)
        {
            try
            {
                ITStorage itss = (ITStorage)(new ITStorageCoClass());
                IStorage iSt = itss.StgOpenStorage(sName, new IntPtr(0), STGM_READ, new IntPtr(0), 0);
                if (iSt != null)
                {
                    return new IStorageEx(iSt);
                }
            }
            catch
            {
            }
            return null;
        
        }

    }
}

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)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions