interop

object of Interop Word Document Class is null on Windows Server 2008 - Word Open method

给你一囗甜甜゛ 提交于 2019-12-13 18:45:49
问题 While I am opening word document and saving it on my machine its working fine, but when I am uploading it on server and opening it there, It is going in if (doc == null) block, it should not go. Please update my question title if its not relevant or ask for any clarification. Here is my class: using System; using System.Collections.Generic; using System.Web; using Microsoft.Office.Interop.Word; /// <summary> /// Summary description for ClsWordExManager /// </summary> public class

exception calling CertFreeCertificateContext during callback using PInvoke to access ldap functionality

你说的曾经没有我的故事 提交于 2019-12-13 18:13:25
问题 I am getting access violation exceptions when running the code below when the CertFreeCertificateContext method is invoked. I imagine it is because of the way the pServerCert argument is being Mashalled on the LdapServerCertDelegate but have been unable to find a solution. using System; using System.Runtime.InteropServices; namespace ldaptest { class Program { static void Main(string[] args) { new LdapAuthenticationProvider().AuthenticateUser("a.qas", "a", "administrator", "test123"); } }

convert .net 4.0 syntax OfType to .net 3.5

风格不统一 提交于 2019-12-13 16:00:23
问题 I have this .NET 4.0 code: var myTable = tables[1]; myTable = tables.Item["Table1"]; myTable = tables.OfType<Excel.ListObject>().FirstOrDefault(t => t.Name == "Table1"); I am trying to compile with .NET 3.5 and getting a bunch of errors: Error 23 Property, indexer, or event 'Item' is not supported by the language; try directly calling accessor method 'Microsoft.Office.Interop.Excel.ListObjects.get_Item(object)' and Error 24 'Microsoft.Office.Interop.Excel.ListObjects' does not contain a

InvokeMethod of Windows Workflow 4 can encounter Exception C0000005

天大地大妈咪最大 提交于 2019-12-13 15:52:33
问题 Thank you for reading at first. I designed a WPF application which rehosted the Designer, Toolbox and Properties of Windows Workflow. My Idea is really simple that I just want have visualization at runtime about my workflow and design them in the runtime as well. ISSUE: Now I try to Invoke a Method of a class under the same namespace of whole application. The class is called MyTwsClass. Please have a look below: It is extremely Simple. The TwsClass is from a Reference ActiveX of Interactive

Why does Excel not close after building PDF?

给你一囗甜甜゛ 提交于 2019-12-13 15:50:41
问题 I use this code to convert an excel file to PDF. The problem is that the Excel process is not close. What am I missing? protected void Indexchanged_ConvertPDF(Object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); xlApp.DisplayAlerts = false; xlApp.Visible = false; xlApp.ScreenUpdating = false; string path = CertificadosPresion.SelectedRow.Cells[0].Text; string CertName = CertificadosPresion.SelectedDataKey.Value

Inheriting from native C++ in C# and passing the inherit class backward to c++

为君一笑 提交于 2019-12-13 15:42:28
问题 I've an engine in a native C++ dll and I need to use it in a C# project. I'm totally new on doing that, but I've been googling for hours and now I know more or less how to achieve it. I know I've to write a C# or C++/CLI wrapper class. But I haven't found how to wrap some aspects of the dll C++ class. The engine has class CEntity whith this important part: class CEntity { void SendMsg(CEntity *receiver); virtual void ReceiveMsg(MSG msg); } That works as follows: A inherit class from CEntity

PInvoke: Allocate memory in C++ and free it in C#

♀尐吖头ヾ 提交于 2019-12-13 13:26:30
问题 We are using PInvoke to interop between C# and C++. I have an interop struct as follows, with an identical layout C++ struct on the other side. [StructLayout(LayoutKind.Sequential)] public struct MeshDataStruct : IDisposable { public MeshDataStruct(double[] vertices, int[] triangles , int[] surfaces) { _vertex_count = vertices.Length / 3; _vertices = Marshal.AllocHGlobal(_vertex_count*3*sizeof (double)); Marshal.Copy(vertices, 0, _vertices, _vertex_count); } // .. extract data methods to

Runtime C# knowing if 32-bit or 64-bit version of COM Interface is being used

淺唱寂寞╮ 提交于 2019-12-13 12:29:02
问题 I want to build a DLL Class Library use COM Interop, with C#, target ANY CPU, and register it as 32-bit and 64-bit interfaces. I want to be able to, at runtime, display what interface was used - if I am using the 32-bit version, or 64-bit version. Any ideas? 回答1: In order for a process to load a 32-bit DLL, the process has to be 32-bit. And same for 64-bit. So to find out what has been loaded, assuming it has already worked, you just need to find out the bit-ness of the CLR: if (System.IntPtr

How to set printer properties using vb.net

只愿长相守 提交于 2019-12-13 08:47:51
问题 I am using EDRAW to browse a Microsoft Word and can be Print , Preview , ETC.. . And I am planning to add some features to it. I am adding 2 buttons for Print Short (8.5 by 11 inches) and Print Long (8.5 by 13 inches) and I have 2 printers for long and short. How to set the properties of the printers in each button?. If I click button short it will print short using printer 1 same as the button long but it is in printer 2. I am following the code in the Link provided above. Anyone has an idea

Is it safe to use enums across interop boundaries?

别来无恙 提交于 2019-12-13 07:57:15
问题 I'm writing a set of DLLs which allows other developers write their own DLL as an extension. In the Delphi code, I widely use enums, and enum sets. I use enums through DLLs. I know I can safely use an enum through a DLL across different projects compiled with Delphi. However, I'm not sure about how adaptable it is across various languages. Is it safe to use enums through a DLL while supporting other various languages? Or should I cast it as an integer instead? 回答1: Enums need to be passed as