interop

C++/cli -> calling c# dll -> calling OpenFileDialog issue

◇◆丶佛笑我妖孽 提交于 2019-12-04 16:12:34
I write extensions to a C++ program. I write standard C/C++ dlls and I use IJW to call C# dlls. This has always worked perfectly until I wrote and called a C# dll that in turn called an OpenFileDialog and a SaveFileDialog. Whenever either was called with ShowDialog, the app would freeze. So in making a "Minimum Working Example" I got an: An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function

C# Visual Studio: How to have multiple developers on a solution that references Office?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 15:43:20
When I add a reference to Office COM Library, I to go: References Add Reference Select the COM tab Select Microsoft Office 12.0 Object Library And magically named reference appears: Microsoft.Office.Core The Project.csproj file shows the details of the reference: <COMReference Include="Microsoft.Office.Core"> <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid> <VersionMajor>2</VersionMajor> <VersionMinor>4</VersionMinor> <Lcid>0</Lcid> <WrapperTool>primary</WrapperTool> <Isolated>False</Isolated> </COMReference> i check the project into source control, and now nobody else can build the

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

ぃ、小莉子 提交于 2019-12-04 15:42:30
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\Microsoft.NET\Framework\v2.0.50727\regasm.exe" "C:\Program Files\AppName\Control.dll" /tlb:"C:\Program

How to catch any Javascript exception in Clojurescript?

我们两清 提交于 2019-12-04 15:39:08
问题 In my communication layer I have a need to be able to catch ANY javascript exception, log it down and proceed as I normally would do. Current syntax for catching exceptions in Clojurescript dictates that I need to specify the type of the exception being caught. I tried to use nil, js/Error, js/object in the catch form and it doesn't catch ANY javascript exception (which can have string as the type of the object). I would appreciate any hints how this can be done natively in Clojurescript. 回答1

Wrapping Visual C++ in C#

☆樱花仙子☆ 提交于 2019-12-04 14:39:57
I need to do some process injection using C++ but I would prefer to use C# for everything other than the low level stuff. I have heard about "function wrapping" and "marshaling" and have done quite a bit of google searching and have found bits of information here and there but I am still really lacking. Things I have read in order of usefulness; http://msdn.microsoft.com/en-us/library/ms235281(VS.80).aspx http://www.drdobbs.com/cpp/184401742 http://geeklit.blogspot.com/2006/08/calling-c-lib-from-c.html How can I wrap all the lower level stuff (native C++) in C# so I can easily command those

How can I pass a JavaScript function to Silverlight?

非 Y 不嫁゛ 提交于 2019-12-04 13:59:27
I'm evaluating the JavaScript/Silverlight interop capabilities and have been able to create a Silverlight instance using JavaScript and call methods on it. However, I now need a way of passing a JavaScript callback function to Silverlight. Simply passing a JavaScript function to a Silverlight method expecting an Action doesn't work although the error suggest that it's intended to. What am I missing? The exception details: Microsoft JScript runtime error: System.ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the

C/C++ within Ruby code?

倖福魔咒の 提交于 2019-12-04 13:38:35
问题 C/C++ would be good option to write some of the performance critical aspects of a Ruby Application. I know this is possible. I would like to know how to add C/C++ code into Ruby code; any other language for that matter. Are there any practical applications of this which you noticed in open source projects or else? 回答1: Besides "Extending Ruby", here are two other resources: README.EXT (extension.rdoc) - shows you more about how to build C extensions. A good compliment to "Extending Ruby" Ruby

P/Invoke with Shell32, bypass Interop.Shell32.dll generation

雨燕双飞 提交于 2019-12-04 13:00:34
So I'm using the following code to dump every extended file attribute to the debug console... ShellClass shellClass = new ShellClass(); Folder dir = shellClass.NameSpace(Path.GetDirectoryName(sFilePath)); FolderItem item = dir.ParseName(Path.GetFileName(sFilePath)); for (int i = 0; i < 267; i++) { System.Debug.WriteLine(dir.GetDetailsOf(item, i)); } As Shell32 is a non-managed library, I can't embed the DLL resource in the program directly, and it has to generate an interop helper DLL. Anyone know of the DLLImport command lines for these functions in Shell32 to get around the whole generation

C# 2.0 Fastest way to parse Excel spreadsheet [duplicate]

不羁的心 提交于 2019-12-04 12:50:15
Possible Duplicate: Reading Excel files from C# What is the fastest way to read large sets of data from excel from Csharp. Example code would be great . . In our desktop environment, I have reached the best mix between performance, flexibility and stability by using Excel via COM. Access to Excel is always via the same thread. I use late-binding (in VB.Net) to make my app version independent. The rest of the application is developed in C#, only this part and some other small parts are in VB, because they are easier in VB.Net. Dim workBook As Object = GetObject(fileName) Dim workSheet As Object

C# .NET Charts Libraries/Code? [closed]

寵の児 提交于 2019-12-04 12:39:48
I am creating some reporting software that will generate excel workbooks with charts and all related data. Besides the built in libraries and .NET Office integration features, is there any other tools or code that people found useful to creating similar projects? EDIT: I am targeting winforms. Matthew Groves I've used ZedGraph before, and I found it pretty good for a free library. If you are not already aware... Microsoft released these free charting controls for .NET http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx Nick