interop

Microsoft Office Interop Assembly references

不想你离开。 提交于 2019-12-01 05:54:07
I have an application developed in Visual Studio 2005 which I am deploying using ClickOnce. My solution contains two projects - a user interface layer coded in VB, and a class library coded in C#. My C# class library has some code that uses the Outlook and Excel Interop Assemblies (Microsoft.Office.Interop.Outlook and Microsoft.Office.Interop.Excel, both version 11). Here are my questions. Although I haven't found where this is stated as an absolute, my understanding is that you MUST have the appropriate versions of the Office applications (Outlook/Excel) in order to install an application

COM Exception 80040154 When creating an Excel Application

末鹿安然 提交于 2019-12-01 05:52:18
I'm trying to run my application on a server which does not and will not have Office installed on it. using EXCEL = Microsoft.Office.Interop.Excel; ... EXCEL.Application app = new EXCEL.Application();//Exception thrown here The code is working fine on my own system, but on the server it gives the following exception: Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). both systems are 32bits,

How to get all memory address space used by a process?

℡╲_俬逩灬. 提交于 2019-12-01 05:25:33
I need to know all memory address space used by a process. The memory space will later be scanned to locate values within the process and identify their locations / addresses. My current process for this is to take each module's base address through its (base address + memory size). I'm testing this on a process with a known value at a known address. When I look up that specific address, I get the value I expect. However, when I scan (what I believe to be) all address space used by the process, I can't find the value anywhere. I know that a numeric value "4143000" exists at 0x0CF8DC38 and

using c# to sort a column in excel

不羁岁月 提交于 2019-12-01 05:04:13
问题 i am trying to sort a worksheet by the first column in excel using INTEROP. i just want a simple sort of the entire range by the first column. i am doing the following: valueRange.Sort(valueRange.Columns[7, Type.Missing], Excel.XlSortOrder.xlAscending, valueRange.Columns[7, Type.Missing], Type.Missing, Excel.XlSortOrder.xlAscending, Type.Missing, Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlNo, Type.Missing, Type.Missing, Excel.XlSortOrientation.xlSortColumns, Excel.XlSortMethod

Is there a way for registration free activation of EXE COM components

纵然是瞬间 提交于 2019-12-01 04:56:41
问题 Is there a way to activate a COM component which is an EXE COM application and also it's dependent COM dlls? I want to activate this COM component from .NET application(VS 2005/VS 2008). The path of call is C# application --> invoking out-of-proc exe(this is through COM) and then this out-of-proc invokes few COM dlls 回答1: Reg-free COM does not work for out of process components. ActiveX EXE and ActiveX Document project types cannot be used with Reg-Free COM, as discussed in the sidebar.

Microsoft Office Interop Assembly references

青春壹個敷衍的年華 提交于 2019-12-01 04:45:54
问题 I have an application developed in Visual Studio 2005 which I am deploying using ClickOnce. My solution contains two projects - a user interface layer coded in VB, and a class library coded in C#. My C# class library has some code that uses the Outlook and Excel Interop Assemblies (Microsoft.Office.Interop.Outlook and Microsoft.Office.Interop.Excel, both version 11). Here are my questions. Although I haven't found where this is stated as an absolute, my understanding is that you MUST have the

Passing string array from VB6 to C#.net

♀尐吖头ヾ 提交于 2019-12-01 04:41:53
How to pass a VB6 string array [Assume, s =Array("a", "b", "c", "d")] to C#.Net through COM Interop? I tried to implement passing C# string array to VB and VB string array to C# as below C#->VB working fine but other way (VB=>C#) giving a compile error called "Function or interface marked as restricted, or the function uses an automation type not supported in visual basic" . My code below C# public interface ITest { string[] GetArray(); void SetArray(string[] arrayVal ); } public class Test : ITest { string[] ITest.GetArray() { //Working fine string[] stringArray = { "red ", "yellow", "blue" }

PCWSTR vs LPWSTR

孤者浪人 提交于 2019-12-01 04:33:26
It is my understanding (and please correct me if I'm wrong) that the only difference between them is whether the string might be modified by the called function. ( PCWSTR , LPWSTR ) I am now trying to pass a string from C# to a function expecting a PCWSTR , but all I can find is [MarshalAs(UnmanagedType.LPWStr)] . Am I correct that that is fine? (Yes, it works . That, though, is not a proof that it's fine. Some things work but then cause memory leaks etc.) PCWSTR is a time anachronism, dinosaur-and-humans movie style. Finding a 16-bit program that uses short pointers on a Unicode string is

Why can't I retrieve ALL MailItems using interop outlook?

帅比萌擦擦* 提交于 2019-12-01 04:26:26
问题 I'm trying to use Microsoft.Office.Interop.Outlook to retrieve emails from my Outlook inbox. This is my code: Application app = new Application(); NameSpace ns = app.Session; MAPIFolder inbox = ns.GetDefaultFolder(OlDefaultFolders.olFolderInbox); Items items = inbox.Items; foreach (Microsoft.Office.Interop.Outlook.MailItem mail in items) { if (mail as MailItem != null) { Console.WriteLine(mail.Subject.ToString()); Console.WriteLine(mail.Body.ToString()); Console.ReadKey(); } } When I do this,

Marshalling BSTRs from C++ to C# with COM interop

别等时光非礼了梦想. 提交于 2019-12-01 04:25:37
I have an out-of-process COM server written in C++, which is called by some C# client code. A method on one of the server's interfaces returns a large BSTR to the client, and I suspect that this is causing a memory leak. The code works, but I am looking for help with marshalling-out BSTRs. Simplifying a bit, the IDL for the server method is HRESULT ProcessRequest([in] BSTR request, [out] BSTR* pResponse); and the implementation looks like: HRESULT MyClass::ProcessRequest(BSTR request, BSTR* pResponse) { USES_CONVERSION; char* pszRequest = OLE2A(request); char* pszResponse = BuildResponse