interop

How pass an decimal from c# to vb6 with Interop

谁都会走 提交于 2019-12-01 20:37:16
I have an interop c# class with a property: decimal ImportoDocumento { get; set; } if i try to access to this property from vb6 a receive an error: Compiler error: Function or interface marked as restricted or the function uses an automation type not supported in visual basic. So i found this partial solution: decimal ImportoDocumento { [return: MarshalAs(UnmanagedType.Currency)] get; [param: MarshalAs(UnmanagedType.Currency)] set; } but currency supports numbers with max 4 decimals. i have numbers with 6 decimals too. How can i do? The error message is appropriate, decimal is not a valid

WCF: Is using WsHttpBinding interoperable?

元气小坏坏 提交于 2019-12-01 20:08:54
As the name states... right now I'm using BasicHttpBinding, but I'm wondering if I can switch to WSHttpBinding and still be interoperable with, for example, Java. wsHttpBinding and the newer ws2007HttpBinding both implement WS-* standards. You may have to configure the details so that they interoperate with your specific clients. WSHttpBinding offers a lot of interoperable features but in the same time it by default uses message security with Windows authentication, service credentials negotiation over SPNego protocol and security context (WS-SecureConversation). Windows authentication and

How to get page number?

瘦欲@ 提交于 2019-12-01 19:38:13
I have this code: Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application(); object nullobj = System.Reflection.Missing.Value; object file = openFileDialog1.FileName; Microsoft.Office.Interop.Word.Document doc = app.Documents.Open( ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj); doc.ActiveWindow.Selection.WholeStory(); doc.ActiveWindow.Selection.Copy(); IDataObject data = Clipboard.GetDataObject(); string text =

How to iterate and count Revisions in a Word document using C#?

a 夏天 提交于 2019-12-01 19:28:39
I have been looking around for this but couldn't find an answer anywhere, so hope aomeone here can help. I am doing a WinForms application in C# in wich i use WordApplcation.CompareDocuments to compare two documents and get a result document with the changes marked as Revisions. This works well and apart from the revisions hiding stuff inside textboxes (wich i don't care about just yet) i get exactly what i want. So next step is to count how many words got revised - specifically wdRevisionDelete and wdRevisonInsert. Only problem is final.Revisions is sometimes empty or contains enourmous

Excel automation: Close event missing

↘锁芯ラ 提交于 2019-12-01 18:37:32
问题 Another hi all, I am doing Excel automation via Interop in C#, and I want to be informed when a workbook is closed. However, there is no Close event on the workbook nor a Quit event on the application. Has anybody done that before? How can I write a piece of code which reacts to the workbook being closed (which is only executed if the workbook is really closed)? Ideally that should happen after closing the workbook, so I can rely on the file to reflect all changes. Details about what I found

Excel automation: Close event missing

做~自己de王妃 提交于 2019-12-01 18:20:20
Another hi all, I am doing Excel automation via Interop in C#, and I want to be informed when a workbook is closed. However, there is no Close event on the workbook nor a Quit event on the application. Has anybody done that before? How can I write a piece of code which reacts to the workbook being closed (which is only executed if the workbook is really closed)? Ideally that should happen after closing the workbook, so I can rely on the file to reflect all changes. Details about what I found so far: There is a BeforeClose() event, but if there are unsaved changes this event is raised before

Smooth way of using Function<A, R> java interface from scala?

随声附和 提交于 2019-12-01 17:51:09
Here at work most people use Java, while I am working with Scala. We have decided to gather some common classes in an library which will be written in Java. Now I want to add some pseudo-functional programming to the library, take a look at the following: java: public interface Func<A, R> { public R f(a A); } public AClass { public <R> ArrayList<R> myMethod( Func<String, R> func ) { // ... } } usage in java: AClass ac = new AClass(); ArrayList<String> al = ac.myMethod( new Func<String, String> ( public String f(String s) { return s + "!"; } }) The above is not exactly exiting (more like

How do I generate COM interop proxies into C# source code?

ε祈祈猫儿з 提交于 2019-12-01 17:46:35
问题 This questions is a follow up on an answer by Paul Alexander to the question "Should interop assemblies be signed?". Depending on how complex your Interop assemblies are - you can generate the proxy code into a separate .CS/.VB file and compile it directly into your assembly. Then you won't have to worry about strong name issues. How would I go about generating the interop proxy code for a COM library into C# source code? I guess it could be done with tlbimp and then extracting the source

Smooth way of using Function<A, R> java interface from scala?

北慕城南 提交于 2019-12-01 17:27:48
问题 Here at work most people use Java, while I am working with Scala. We have decided to gather some common classes in an library which will be written in Java. Now I want to add some pseudo-functional programming to the library, take a look at the following: java: public interface Func<A, R> { public R f(a A); } public AClass { public <R> ArrayList<R> myMethod( Func<String, R> func ) { // ... } } usage in java: AClass ac = new AClass(); ArrayList<String> al = ac.myMethod( new Func<String, String

When should I explicitly specify a StructLayout?

試著忘記壹切 提交于 2019-12-01 17:14:32
I'm fiddling with calling DLLs from C#, and came across the need to define my own structs. Lots of articles force a sequential layout for the struct with [StructLayout(LayoutKind.Sequential)] struct Foo ... So, I followed suite, and my programme worked. Now, when I took the line out, it still works. Why do I need it? The internal layout of a managed struct is undocumented and undiscoverable. Implementation details like member order and packing are intentionally hidden. With the [StructLayout] attribute, you force the P/Invoke marshaller to impose a specific layout and packing. That the default