Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Active Document under internet explorer (IOleDocument / IOleDocumentView

Active Document under internet explorer (IOleDocument / IOleDocumentView

Scheduled Pinned Locked Moved Web Development
comcsharphelpsecuritytutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roey C
    wrote on last edited by
    #1

    hello everyone, i'm trying to create an active document activeX for my files. so that they would show up inside the browser after being downloaded (just like PDFs and office files). i'm trying to use the IOleDocument and IOleDocumentView interfaces to work with IE with c#. i've created a dll file which import the Microsoft.VisualStudio.OLE.Interop namespace and then two classes that implement the IOleDocument and IOleDocumentView interfaces. i also managed to configure IE to call my dll using a guid. the problem begins after clicking the file click in IE, and this is the error message i get: "the file you are downloading cannot be opened by the default program.it is either corrupted or it has an incorrect file type.as a security precaution, it is recommended that you cancel the download" this is my code: using System; using System.Runtime.InteropServices; using System.IO; using System.Text; using System.Windows.Forms; using Microsoft.Win32; using System.Reflection; using System.Net; using Microsoft.VisualStudio.OLE.Interop; namespace WebControl { [ComVisible(true), Guid("AB3A4D48-E6CA-42db-8D68-101D9A1BFDC4"), ClassInterface(ClassInterfaceType.AutoDual)] public class ViewerPlugin : IOleDocument { IOleDocumentView pView = null; public void CreateView([InAttribute] IOleInPlaceSite pIPSite, [InAttribute] IStream pstm, [InAttribute] uint dwReserved, out IOleDocumentView ppView) { using (TextWriter tw = new StreamWriter("c:\\log.txt", false, Encoding.Default)) { tw.WriteLine("blabla"); } pView = new WebControl(); // Return the view ppView = pView; } public void EnumViews(out IEnumOleDocumentViews ppEnum, out IOleDocumentView ppView) { using (TextWriter tw = new StreamWriter("c:\\log.txt", false, Encoding.Default)) { tw.WriteLine("blabla"); } ppEnum = null; ppView = pView; } public void GetDocMiscStatus(out uint pdwStatus) { using (TextWriter tw = new StreamWriter("c:\\log.txt", false, Encoding.Default)) { tw.WriteLine("blabla"); } pdwStatus = 8; } } } does anybody happens to know how to actually create active documents in C#?? thanks, Roey

    Don't believe to what you

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups