Hi !! about your question, were you able to find the solution at last? Thanks Roey
Don't believe to what you hear on the news...
Hi !! about your question, were you able to find the solution at last? Thanks Roey
Don't believe to what you hear on the news...
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
the problem you are talking about is well known. there is a away solving it using: GCHandle?.Alloc(data, GCHandleType.Pinned); UnmanagedFunction(gcHandle.Value.AddrOfPinnedObject(), (UIntPtr)0, (uint)flags); the first function, tells the gc not to move the data from it's memory block. and the second one send the pointer to data to your unmanaged function. hope that helps, Roey
Don't believe to what you hear on the news...