interop

PInvoke CreateDesktop

空扰寡人 提交于 2019-12-11 12:15:17
问题 I am trying to PInvoke CreateDesktop in a way that passes the flag to inherit the desktop by child processes. The declaration is as follows: [DllImport("user32", EntryPoint = "CreateDesktopW", CharSet = CharSet.Unicode, SetLastError = true)] public static extern IntPtr CreateDesktop(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, int dwFlags, int dwDesiredAccess, [MarshalAs(UnmanagedType.LPStruct)] SECURITY_ATTRIBUTES lpsa); [StructLayout(LayoutKind.Sequential)] public struct SECURITY

what is the easiest way to pass a list of integers from java to a frege function?

青春壹個敷衍的年華 提交于 2019-12-11 11:56:48
问题 Assume I have a Frege module module Util where total :: [Int] -> Int total xs = fold (+) 0 xs If "total" was written in Java, I could call it via Util.total(Arrays.asList(1,2,3)); What is the best way to call the Frege implementation from Java? 回答1: You could use a good old int [] array, the corresponding frege type would be JArray Int. Because arrays can be made from and into lists in both Java and frege, they are good for such tasks. Please use the repl to get an idea how to convert the

Get previous MailItem when reply on outlook

穿精又带淫゛_ 提交于 2019-12-11 11:53:12
问题 We are developer an outlook plugin. We provide an button work as alternative of default Send button. We need save all MailItem replied by our button to a specific category. When user reply an email (in new inspector), how can I get the main MailItem be replied ? 回答1: A user can reply from either Explorer or Inspector. In case of Explorer, trap the Explorer.SelectionChange event and set up event sinks on the selected items. You can trap the MailItem.Reply/ReplyAll/Forward events. In case of

C# FindWindowEx Obtain parameter for lpszClass variable by WinSpy++ not work

走远了吗. 提交于 2019-12-11 11:26:31
问题 PROBLEM This is my function to send key stroke in background. class SendMessage { [DllImport("user32.dll")] public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

“Catastrophic failure” when accessing an OCX library from C#

…衆ロ難τιáo~ 提交于 2019-12-11 10:54:16
问题 I'm currently trying to use a third-party DLL from my C# application. I've registered the DLL and added it as a reference from the list of COM component. As I understand, this should create the necessary interop classes to access this DLL from C#. On attempting to call any methods from within the DLL I get the following exception:- System.Runtime.InteropServices.COMException was unhandled Message=Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) Source=mscorlib

How to do a Mail Merge in C# using Interop.Word?

梦想的初衷 提交于 2019-12-11 10:08:01
问题 I have a template in Word that would be used to print out invoices. Now, I would like to know how to create a Word Document programmatically and copy the template content into the new document so that I still have a clean template, then replace placeholders that I have typed by using Mail.Merge. I found similar Mail.Merge questions but most require Spire components and I am not interested since it needs to be paid for. I am only a student. Others though, actually doesn't help that much. The

Detect when rows have been deleted by user in Excel 2003

こ雲淡風輕ζ 提交于 2019-12-11 09:16:50
问题 I have a C#.Net add-in to Excel 2003. I am hoping there is a hook (event?) to which I can attach, to detect when the user has deleted a row or rows from the active worksheet, as some caches will need to be recomputed or discarded when this happens. Is there any such hook or event? If not, is there a way of achieving what I want? 回答1: Unfortunately, there doesn't appear to be a way to detect when a row is deleted. According to the Worksheet event list, you could use the Change event to figure

How do I pass an array from .Net to C?

六月ゝ 毕业季﹏ 提交于 2019-12-11 09:02:45
问题 I am trying to make use of an open source library, written in C, by wrapping it and exposing it to .Net. I am not, by any stretch, a C expert. So far, I have managed to call the demo code, written in C, from F#. I managed to get this far by following this guide then filling in the blanks. I have adapted the C code to expect an int passed to it, so I can at least take in a scalar value from F# into C. No return value though. But working with arrays is much trickier. My C code is extern "C" { _

Trouble using .NET DLL in Borland C++ Builder 4

和自甴很熟 提交于 2019-12-11 08:35:25
问题 I have created a COM callable DLL in C# .NET 2.0 and created a TLB from the assembly using the .NET regasm tool. In Borland C++ Builder 4.0 I go to Project->Import Type Library-> and find my DLL's type library there and click "Ok" to import it. BCB creates an HardwareCheck_TLB.cpp & HardwareCheck_TLB.h file. In a cpp file of the project I want to use the DLL I put: #include "HardwareCheck_TLB.h" at the top. Then in code if I try to declare an object of that type in code: IHardwareCheck hc =

How to fix this unmanaged exports trouble using Delphi/C#

烂漫一生 提交于 2019-12-11 08:18:35
问题 I came across Unmanaged exports technique in this anwser on SO. I can manage myself to have simplest project working on SharpDevelop, albeit I don't have a good command of C#. I want to use the excellent Gavaghan.Geodesy (.Net/C#) library written by Mike Gavaghan. I want to avoid interoperability through COM. I definitely use Delphi. I only want to harness the library with it. I managed to build the following code : using System; using System.Collections.Generic; using System.Text; using