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

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

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


namespace WinHelpLib
{
    class IStreamEx : Stream 
    {
        IStream iStream;
        long lSize = 0;

        public IStreamEx(IStream iStr) 
        { 
            iStream = iStr; 
          
            Microsoft.VisualStudio.OLE.Interop.STATSTG[] stInfo = new Microsoft.VisualStudio.OLE.Interop.STATSTG[1];
            iStream.Stat(stInfo, (uint)STATFLAG.STATFLAG_NONAME);

            lSize = Convert.ToInt32(stInfo[0].cbSize.QuadPart);
        }
        
        public override bool CanRead 
        { 
            get { return true; } 
        } 
        
        public override bool CanSeek 
        { 
            get { return false; } 
        } 
        
        public override bool CanWrite 
        { get { return false; } 
        }

        public override long Length
        {
            get { return lSize; }
        }
        
        public override long Position 
        { 
            get { 
                ULARGE_INTEGER[] nlip = new ULARGE_INTEGER[1];
                nlip[0] = new ULARGE_INTEGER();

                LARGE_INTEGER li = new LARGE_INTEGER();
                li.QuadPart = 0;
                iStream.Seek(li, (uint)STREAM_SEEK.STREAM_SEEK_CUR, nlip);
                return Convert.ToInt32(nlip[0]);
            } 
            set {
                LARGE_INTEGER li = new LARGE_INTEGER();
                li.QuadPart = value;
                iStream.Seek(li, (uint)STREAM_SEEK.STREAM_SEEK_SET, null);
            } 
        } 
        
        public override int Read(byte[] buffer, int offset, int count) 
        {
            uint cb = Convert.ToUInt32(count);
            uint uiRead = 0;

            byte[] inBuffer = new byte[count];

            iStream.Read(inBuffer, cb, out uiRead);

            inBuffer.CopyTo(buffer, offset);


            return Convert.ToInt32(uiRead);
        }

        public override void Write(byte[] buffer, int offset, int count)
        {
            throw new NotImplementedException();
        }

        public override void SetLength(long value)
        {
            throw new NotImplementedException();
        }
        public override long Seek(long offset, SeekOrigin origin)
        {
            throw new NotImplementedException();
        }

        public override void Flush()
        {
            throw new NotImplementedException();
        }

    }
}

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 | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 5 May 2011
Article Copyright 2011 by Veselin Tenev
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid