interop

Microsoft.Office.Interop.Excel.ApplicationClass has no constructor defined

佐手、 提交于 2019-12-03 23:23:23
问题 I tried to follow How to open an Excel file in C# tutorial, i.e. added a reference on the Com tab to Microsoft Office 14.0 Object Library and tried to compile code: using Excel = Microsoft.Office.Interop.Excel; //... Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; xlApp = new Excel.ApplicationClass();//error here //... and faced a compile-time error, saying There is no constructor defined for Microsoft.Office.Interop.Excel.ApplicationClass type. What am I

Register for COM Interoperability

江枫思渺然 提交于 2019-12-03 21:59:23
I create the following class library in C#: [InterfaceType(ComInterfaceType.InterfaceIsDual)] //[Guid(<Generate GUID here>)] public interface _None1 { int retval { get; } } [ClassInterface(ClassInterfaceType.None)] //[Guid(<Generate GUID here>)] [ProgId("Lotr.Test")] public class None : _None1 { public int retval { get { return 1; } } } Then I compile it using "Register for COM Interop" and "Make Assembly COM-visible" options. When I try to access it using Excel 2007 VBA on my machine, works fine. However, if I take the .dll and .tlb files to another machine, and then use regasm to register it

Why would native code called from .net give different result from calling it from a native program?

妖精的绣舞 提交于 2019-12-03 21:55:51
We've got a native library which we use to perform security related tasks for us. We've written an interop library so that we can use it from .NET. We've got two test applications, the first application is written in C++ (unmanaged) and the second is written in C#. They generate the exact same sequence of calls to the native library, but produce different results. I'm lost and can't find any apparent mistake in the .NET import definitions. I've already dumbed it down so that I only work with a very simple interface. I'm looking for ideas why calling a native library from a .NET environment

Excel worksheet in Windows form application without opening Excel application

大憨熊 提交于 2019-12-03 21:33:58
I am converting several VBA projects to Windows form applications. The only problem I have is that some of the functionality of Excel is essential to the application, such as R1C1 formulas. I do not want to instantiate the Excel application or access saved worksheets. All of the data is retrieved by querying Oracle databases. 2-Dimensional arrays are not an option because the columns contain differing datatypes, and DataGridViews are too slow to work with. I thought simply dimming a Microsoft.Office.Interop.Excel.Worksheet object would be enough, but the program kept failing and upon

How would a php or java client authenticate if I'm using WCF w/ forms auth?

醉酒当歌 提交于 2019-12-03 21:32:57
I have a generic proof of concept WCF service that is using forms authentication to secure access. All works great when my client is .NET (vb code below) Dim client As SupplierServiceClient = New SupplierServiceClient() client.ClientCredentials.UserName.UserName = "xxxx@xxx.xx.xx" client.ClientCredentials.UserName.Password = "password" Dim SupplierList As List(Of Supplier) = client.GetSuppliers() but as I want this to interop w/ anyone who can do SOAP 1.1/1.2 - how would a PHP or Java client connect? My WCF web.config is listed below (fyi) <system.serviceModel> <services> <service name=

CryptoAPI C++ interop with Java using AES

对着背影说爱祢 提交于 2019-12-03 21:30:02
I am trying to encrypt in C++ using CryptoAPI and decrypt Java using SunJCE. I have gotten the RSA key to work -- and verified on a test string. However, my AES key is not working -- I get javax.crypto.BadPaddingException: Given final block not properly padded . C++ Encryption: // init and gen key HCRYPTPROV provider; CryptAcquireContext(&provider, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, CRYPT_VERIFYCONTEXT); // Use symmetric key encryption HCRYPTKEY sessionKey; DWORD exportKeyLen; CryptGenKey(provider, CALG_AES_128, CRYPT_EXPORTABLE, &sessionKey); // Export key BYTE exportKey[1024];

MS Access interop - Data Import

℡╲_俬逩灬. 提交于 2019-12-03 21:20:49
I am working on a exe to export SQL to Access, we do not want to use DTS as we have multiple clients each exporting different views and the overhead to setup and maintain the DTS packages is too much. *Edit: This process is automated for many clients every night, so the whole process has to be kicked off and controlled within a cursor in a stored procedure. This is because the data has to be filtered per project for the export. I have tried many ways to get data out of SQL into Access and the most promising has been using Access interop and running a doCmd.TransferDatabase(Access

Using app.config with Interop Controls

牧云@^-^@ 提交于 2019-12-03 21:03:31
问题 I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file. Everything in the InteropControl works in VB6 except for what depends on the information in the app.config file. What do I need to change so the MySolution.InteropCtrl can see

(object[,])range.get_Value(XL.XlRangeValueDataType.xlRangeValueDefault) causes a conversion error

喜欢而已 提交于 2019-12-03 20:09:01
Error: Cannot convert type 'string' to 'object[*,*]' That's the error I have been getting. Can someone give me some pointers so that I can avoid it? Thanks. Note: Interestingly, (object[,])range.get_Value(XL.XlRangeValueDataType.xlRangeValueDefault) will only produce this bug when range.Count == 1 . It works fine when count is equal to and above 2. sample code: object[,] arrValue; //global variable private string[] createFormulaCollection() { ArrayList s = new ArrayList(); try { //look at the currently active excel sheet //iterate through cells (not Null) and find the one contains IES(...) /

Wrapping up a C++ API in Java or .NET

别来无恙 提交于 2019-12-03 16:16:37
Has anyone successfully "wrapped up" a C++ API in Java or .NET? I have an application that provides a C++ API for writing plug-ins. What I'd like to do is access that API from .NET or Java. Would I need to use COM, or are there simpler/better alternatives? If you have a very straight forward method signatures (i.e. methods that takes and returns primitive types such as int, char[], void* ... etc), it is reasonably easy to do so in .NET and still possible but a bit harder in Java with JNI. However, if your class methods uses modern C++ programming techniques such as boost shared pointers and