interop

How to list available video modes using C#?

混江龙づ霸主 提交于 2019-12-17 06:14:51
问题 I've found nice examples using C++ (http://www.codeproject.com/KB/tips/resswitch.aspx), but not in C#. Can someone help, please? Edit: The exact function that list the video modes is: BOOL CVideoModes::GetAvailableVideoModes(CAvailableVideoModes& modes) { modes.SetSize(0, 5); int i=0; DEVMODE dm; while (EnumDisplaySettings(NULL, i, &dm)) { CVideoMode thismode(dm.dmBitsPerPel, dm.dmPelsWidth, dm.dmPelsHeight, dm.dmDisplayFrequency); modes.SetAtGrow(i, thismode); ++i; } modes.FreeExtra();

How do you call Python code from C code?

自闭症网瘾萝莉.ら 提交于 2019-12-17 04:16:53
问题 I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python. I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by

P/invoke function taking pointer to struct [duplicate]

梦想与她 提交于 2019-12-14 04:17:26
问题 This question already has an answer here : How do I handle null or optional dll struct parameters in C# (1 answer) Closed last year . Functions such as CreateProcess have signatures taking pointers to structs. In C I would just pass NULL as a pointer for the optional parameters, instead of creating a dummy struct object on the stack and passing a pointer to the dummy. In C#, I have declared it as (p/invoke) [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern bool

“Already listening” when invoking an RPC call

只愿长相守 提交于 2019-12-14 02:49:55
问题 I use Microsoft RPC for interprocess communications. I have an interface with a set of methods accepting a byte pipe as an "in" parameter (IDL description): [ uuid(ActualGuidHere), version(1.0), pointer_default(unique) ] interface IMyInterface { //other irrelevant methods here error_status_t rpcDoAction( [in] pipe byte params ); //more irrelevant methods here } every once in a while when I invoke such methods on a client side through a client stub generated by MIDL and delegated to

Using edge.js is it possible for the .Net C# module to call the node.js part of the process, i.e. do the reverse call?

牧云@^-^@ 提交于 2019-12-14 01:01:35
问题 You can see the interop model for going from Node.js -> C#, here. What I want to know is, can the C# code then make a call to a method in the Node.js part of the process from the C#, before returning? Imagine if you had a call, like var webApi = edge.func('/MyDotNetApi.csx'); webApi(function (error, result) { log.('api started'); }); where the MyDotNetApi.csx returns, but leaves a socket listener thread running to handle HTTP requests. Now, if the Node.js part of the process holds (ever

Late binding of COM->NET call with enum value argument(s)

时光怂恿深爱的人放手 提交于 2019-12-13 23:47:03
问题 First, note that this is just a learning exercise for me. The intent is to produce a .NET messagebox using nothing but pure C++ (not C++/CLI) and late binding as necessary. This works fine with just a title and text in the messagebox. However, when I try to specify buttons I get back 2147942487 "The parameter is incorrect". On the .NET side MessageBox.Show has this as an enum type argument. I am guessing that somehow the integer supplied as argument from C++, isn't automatically converted

Word count using Microsoft.Office.Interop.Word

不羁岁月 提交于 2019-12-13 21:24:36
问题 How can I get the count of occurrences of a particular word in a Word document using Microsoft.Office.Interop.Word ? For example, in my Word document I have two ##<Test Sub Clause1>## tags in different places. I need a total count of its occurrence in a particular document. In my example, it will be 2. Is there is any predefined function that exists in Microsoft.Office.Interop.Word to get this count? Or what is the easiest way to accomplish this? 回答1: Here's something you can try, modified

Exception calling Excel.Interop

半世苍凉 提交于 2019-12-13 20:27:11
问题 I'm experiencing a production issue when opening an Excel Workbook's. The exception thrown is: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005. The event viewer error log detail is: Log Name: Application Source: ASP.NET 2.0.50727.0 Date: 01/11/2018 11:50:32 a.m. Event ID: 1309 Task Category: Web Event Level: Warning Keywords: Classic User: N/A Computer: XXXXX Description: Event code: 3005 Event

How do I get a list of recipients whose mailbox I have shared access to via Outlook Interop

你说的曾经没有我的故事 提交于 2019-12-13 19:18:17
问题 I'm trying to get some information on the recipients whose mailboxes I have shared access to. I know this can be found via OutlookSpy (IMAPISession -> OpenProfileSection -> 00020D0A-0000-0000-C000-00000000004 -> 0x0390), but I don't know where I can get this information via Outlook Interop. Thanks. 回答1: If Outlookspy has the infomation you want then you can use the redemeption libs to get the mapi infomation you want in the same way. They a have a lib called profman 来源: https://stackoverflow

Which features of .NET framework do interop assemblies reference?

余生长醉 提交于 2019-12-13 19:06:56
问题 We have a Visual Studio solution with about 90 projects. Most of them are built to DLL files, some are written in C++, others in C#. The projects communicate with each other via COM. We use tlbexp to generate TLB files of some C# projects (the ones that are referenced in C++ projects). And we use tlbimp to generate interop DLLs of the C++ projects. I did not completely dig into the topic, but I think, the interop files just define the interfaces of the C++ classes, to make them usable from