interop

PIA's Installed but still receiving interop error

廉价感情. 提交于 2019-12-01 14:27:59
I am trying to use the Microsoft.Office.Interop.xxxxxxx namespace but Visual Studio 2010 is not providing an option for "interop". I have the PIA's installed for office12 and office14, I have included them in the 'References' in the Solution Explorer, but it is not working. The code I am trying to call the namespace with is: using Excel = Microsoft.Office...; After "Office.", I am only given the option for "Core". So it would look like this using Excel = Microsoft.Office.Core; This matches the reference that was imported...but using this namespace does not seem to be useful. My question is how

I can't get SetSystemTime to work in Windows Vista using C# with Interop (P/Invoke)

眉间皱痕 提交于 2019-12-01 12:41:58
问题 I'm having a hard time getting SetSystemTime working in my C# code. SetSystemtime is a kernel32.dll function. I'm using P/invoke (interop) to call it. SetSystemtime returns false and the error is "Invalid Parameter". I've posted the code below. I stress that GetSystemTime works just fine. I've tested this on Vista and Windows 7. Based on some newsgroup postings I've seen I have turned off UAC. No difference. I have done some searching for this problem. I found this link: http://groups.google

How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?

此生再无相见时 提交于 2019-12-01 12:25:14
I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project. Visual Studio creates an IStream definition in my own library. How can I stop it from doing that, and get it to use the COMTypes IStream? It seems there would be one of 3 answers: add some import to the idl so it doesn't redeclare IStream (importing MSCOREE does that, but doesn't solve the C# problem)

How to deploy COM object Microsoft.Office.Interop to IIS so that my C# WCF service reference will work?

匆匆过客 提交于 2019-12-01 12:13:16
问题 I am getting an error when trying to run my web application from IIS 7 on my local machine regarding Microsoft.Office.Interop.Outlook that is like the following... Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). When I run this same web app from VS2010 and Cassini I have no problem. When I run the web app from IIS 7 I point my

How to use WebDav to match dav:href to Outolook Interop href value

安稳与你 提交于 2019-12-01 12:12:54
I have previously used webdav to access the sent messages on an exchange 2003 server based on the subject and time and this has worked. I now need to implement another feature which means dragging a message from client outlook (not web access) on to a windows form then querying webdav on exchange to get all the information about this message. I can get the messages href using the following code: Dim msg As MAPI.Message = CType(session.GetMessage(mail.EntryID), MAPI.Message) Dim id as string = CType(CType(msg.Fields(), MAPI.Fields).Item(&H6707001E), MAPI.Field).Value.ToString However there are

Why does excel remain open? [duplicate]

我们两清 提交于 2019-12-01 11:37:45
Possible Duplicate: How to properly clean up Excel interop objects in C# I've this function that I use to calculate the linear trend of some data: private string Trend(object conocido_y, object conocido_x, object nueva_matriz_x) { string result = String.Empty; try { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); result = ((Array)xlApp.WorksheetFunction.Trend(conocido_y, conocido_x, nueva_matriz_x, true)).GetValue(1).ToString(); xlApp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp); xlApp = null; } catch (System

Opening .dat (tab delimited file) in Excel, save as .xls

谁都会走 提交于 2019-12-01 11:27:07
I am trying to open a .dat file in Excel, which is tab delimited, and then have it save out as a .xls file. So far, I can read in the file and save it as the .xls file but for some reason, all the values are in the first column and it does not tab delimit them. (If I open up the file in Excel without my program, it tab-delimits perfectly) These are the two lines of code that I am using to open and resave the file. xlWorkBook = xlApp.Workbooks.Open(f, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlWorkBook.SaveAs(filename + "

How to save *.ppt, *.pptx files as *.wmv using Interop with C#?

天涯浪子 提交于 2019-12-01 11:23:38
I tried to do this with the next code: using Microsoft.Office.Core; using PowerPoint = Microsoft.Office.Interop.PowerPoint; using System.IO; using Microsoft.Office.Interop.PowerPoint; namespace SavePPT { class Program { static void Main(string[] args) { Application app = new PowerPoint.Application(); var pres = app.Presentations; var file = pres.Open(@"C:\Presentation1.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse); file.SaveCopyAs(@"C:\presentation1.wmv", PowerPoint.PpSaveAsFileType.ppSaveAsWMV, MsoTriState.msoCTrue); app.Quit(); } } } But this solution created file

C++ Interop: embedding an array in a UDT

孤街醉人 提交于 2019-12-01 11:19:36
I have an application that involves a lot of communication between managed (C#) and unmanaged (C++) code. We are using Visual Studio 2005 (!), and we use the interop assembly generated automatically by tlbimp. We have fairly good luck passing simple structs back and forth as function arguments. And because our objects are fairly simple, we can pack them into SAFEARRAYs using the IRecordInfo interface. Passing these arrays as arguments to COM methods seems to work properly. We would like to be able to embed variable-length arrays in our UDTs, but this fails badly. I don't think I have been able

System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed

随声附和 提交于 2019-12-01 11:16:58
问题 I am running a c# application and I am using DSOFile dll. This DLL is referenced in the project. I am able to run the exe in my development machine. But when I run the exe in another machine, I am getting Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Not