interop

(UserControl with SQLite) ---> Failed to create components 'UserControl1', System.DllNotFound Excpetion, Unable to Load Sqlite.interop.dll

怎甘沉沦 提交于 2019-12-06 06:58:23
问题 I had a user control with Sqlite. After Compiled and Added to the Tool Box, by dragging it into a new Form,an Error Message as described Below: "Failed to Create Component 'UserControl1'. The Error Message follows 'System.DllNotFoundException: 'Unable to Load Dll 'Sqlite.Interop.dll' : The Specified Module could not be found. Exception from HResult: 0x8007007E I googled on this subject, I'm still unable to resolved this issue. But the funny parts is If I hard coded it in the Form by reference

Getting to Microsoft.Office.Interop.Word.dll?

青春壹個敷衍的年華 提交于 2019-12-06 06:47:09
问题 When FxCop examines an assembly it gives the following error: The following reference assembly could not be found. The assembly is required for analysis and was referenced by Test.dll. Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c So, I did a search and found the file in: C:\Windows\assembly\GAC\Microsoft.Office.Interop.Word\12.0.0.0__71e9bce111e9429c However, the dialog in FxCop doesn't let me get past C:\Windows\assembly. It looks like

Compiling VB6 app w/ .NET interop, only runs if compiled on my machine

烈酒焚心 提交于 2019-12-06 06:45:37
问题 I recently developed an interop user control in .NET (Visual Studio 2008, project targetting .NET 2.0) to be used in a VB6 application. The assembly exposes 1 control, 1 class, and a few enums and structs. I developed it using C# translations of the Interop Forms Toolkit 2.0 project template found here. The assembly has a strong name and gets installed in the GAC and registered with regasm with the following script: @"C:\gacutil.exe" /i "C:\Program Files\AppName\Control.dll" /f @"C:\WINDOWS

How to get the list of all content controls in the document?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:39:37
问题 I am using interop and I want to get the list of all content controls contained in word document (in the body, shapes, header, footer..). Is this the correct and the best way to do this : public static List<ContentControl> GetAllContentControls(Document wordDocument) { if (null == wordDocument) throw new ArgumentNullException("wordDocument"); List<ContentControl> ccList = new List<ContentControl>(); ; // Body cc var inBodyCc = (from r in wordDocument.ContentControls.Cast<ContentControl>()

C# console app that does Excel Interop - failing when running as scheduled Task -System.UnauthorizedAccessException

ⅰ亾dé卋堺 提交于 2019-12-06 05:54:12
问题 As the title states, I have a C# console app which uses interop to open Excel and create a new workbook. The code works fine when running the console app via command line. However this exception is thrown when running the console app via a scheduled task: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 It is thrown from the following call: _xlApp = new Excel

Returning strings from Windows C functions

穿精又带淫゛_ 提交于 2019-12-06 05:46:25
I am a complete novice at pure Windows API-level functions in C and C++ and have been experimenting recently with .NET interoperability. I have built a simple library which has successfully returned numeric values (int/float, etc.) to a .NET caller, but I am not having as much luck with strings. I have tried a variety of different data types, but none appear to work: LPSTR, LPCSTR, LPCTSTR, and LPCWSTR. Admittedly, I haven't tried char*. Also, once a method is set up to return a string, does it require marshalling by .NET as a specific data type, or could it be simply read straight into a

Calling C code from managed code

廉价感情. 提交于 2019-12-06 05:45:49
问题 I currently have a C function that I'd like to use in .NET (C#). I can see two ways of achieving this: Compiling it (I think this is possible) with /clr on VC++.NET, having implemented "façade" managed methods that call the C code. Compiling the C code as a DLL and then making API calls. What do you find best? How to do the first of them? Update As requested, here is the (only) function I need to call from my managed code: int new_game(double* params1, double* params2); Just one more question

Building an OCX with VS.NET?

核能气质少年 提交于 2019-12-06 05:28:53
问题 What happened to OCX's? Are they no longer possible to create with the latest tools? I need to create an ActiveX control that I can place in Word, PowerPoint and Excel documents. If I use VS.NET, I can only create a UserControl DLL with COM Interop, but I don't think I can add that using the "More Controls" toolbox of PowerPoint's Developer Tab. What would you do? 回答1: Yes, you can still create them. But you can't create an OCX with a .NET language. Need to be unmanaged C++ (or VB). The DLLs

How can I create a jar from some Scala source code?

醉酒当歌 提交于 2019-12-06 05:19:11
问题 How can I create a jar from some Scala source code? I want to use some of that code in a Clojure project of mine. Is there a simpler way than doing batch files as in this SO question? Thanks, Alex 回答1: Scala is in no way special when it comes to what you do with the .class files produced by its compiler. Just use the jar command with the c action flag. However, you will need to have the scala-library.jar file in the class-path when you run the program that uses the Scala-compiled .class files

How to call C# delegate to pass array of strings from native C simplest way?

做~自己de王妃 提交于 2019-12-06 04:34:14
问题 I know this can be done by mallocing in C, passing malloced pointer to delegate with parameter type IntPtr, marshalling to string[] and then freeing malloced memory with separate, exported C-function from managed code. My question is: Can this be done simpler way? E.g. : C# delegate parameter is of type string[]? no separate free function to call from managed code EDIT: I tried with delegate signature: [UnmanagedFunctionPointer(CallingConvention.Cdecl)] MyManagedDelegate(string[] values, int