com

setEvent is called without ResetEvent

霸气de小男生 提交于 2019-12-11 02:52:01
问题 what happens if a manual-reset event is set using setEvent but not reset using ResetEvent; and that event is triggered multiple times.i.e. while the event is getting processed, again the event is set. following is the sample task: void foo() { ... SetEvent(hEvent1); ... } void foo1() { ... SetEvent(hEvent2); ... } int MainHandler() { ... dwEvent = WaitForMultipleObjects(2, ghEvents, // array of objects FALSE, // wait for any object 5000); switch(dwEvent) { case hEvent1: //do something break;

Will VB.NET automatically generate ComClass attribute and guids?

≡放荡痞女 提交于 2019-12-11 02:49:08
问题 I've run across some VB.NET code that explicitly creates three GUID constants and uses them in a class's ComClass attribute. I've written COM-aware classes in the past just by checking the "Make COM-Visible" and "Register for COM interop" options in the project options. Is this explicit code simply unnecessary, or is it doing something above-and-beyond what those two options do? Here's a snippet: <ComClass(MenuHandler.ClassId, MenuHandler.InterfaceId, MenuHandler.EventsId)> _ Public Class

Issue when executing IWbemServices.ExecQuery when executing WMI using JNA

六眼飞鱼酱① 提交于 2019-12-11 02:46:43
问题 I am trying to write a Java program which uses JNA to execute WMI query to execute on remote machine (Provided username/password). I am trying to port this WMI example. I have modified this code here for my testing purpose (directly provided username/password) and it works fine. But, in my java code, when executing the query using ExecQuery, I am getting the error code 0x80070005. String machineName = "machine"; String userNameWithDomain = "\\administrator"; String pass = "Password"; String

How can i create COM (in C++) server in VS2010?

孤街醉人 提交于 2019-12-11 02:46:04
问题 recently i want to create some COM Servers for my study project, i can use DLLs but i want to try COM. I'm new to this, i wonder if any one can provide some information about creating COM Server (in VS2010), thank you. 回答1: MSDN would be good starting point: Walkthrough: Creating a COM Server Using a Text Editor 来源: https://stackoverflow.com/questions/5201401/how-can-i-create-com-in-c-server-in-vs2010

InvalidCOMObjectException: COM object that has been separated from its underlying RCW cannot be used?

纵然是瞬间 提交于 2019-12-11 02:45:57
问题 I'm getting this exception thrown when I run my tests: Test method OuvertureClasseur threw exception: System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used... though each of my test passes when ran individually. Here's my tests code: <TestClass()> _ Public Class FabriqueExcelTests Private Shared _xl As ApplicationClass <ClassInitialize()> _ Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) _xl =

Loading CLR in C++, Start() problem

大城市里の小女人 提交于 2019-12-11 02:42:48
问题 So I'm trying to load up the .NET 4 runtime and run my own C# DLL. The Start() method is throwing a HRESULT=0x1 error. If I comment out the start code, the C# DLL loads and executes, then the Stop() method throws a HRESULT=0x8000ffff error. I've looked for hours and all the code looks like what I have below (I left out all my debugging/error handling). Thank you very much for any tips in advance! =) void DotNetLoad() { ICLRRuntimeHost *pClrHost = NULL; ICLRMetaHost *lpMetaHost = NULL;

Error Connecting to Third Party App via COM: mscorlib Exception from HRESULT: 0x80040202

孤者浪人 提交于 2019-12-11 02:42:47
问题 One particular user is getting an exception when connecting an application I created to a third party app using COM. The connection fails with the following error: Source: mscorlib Message: Exception from HRESULT: 0x80040202 This software works fine for other users. Any ideas what could be going on? The error occurs just before the app adds some event handlers to some of the COM objects from the third party app. It is able to successfully instantiate the objects, though. 回答1: The error code

CoreAudioApi with threading - InvalidCastException

纵然是瞬间 提交于 2019-12-11 02:36:43
问题 I'm writing an application to modify the volume of another application and using the CoreAudioApi dll to do so. The following block of code works perfectly on the main thread, but when called in a separate thread, an InvalidCastException is raised. I threw in a Mutex in case this was just an issue of two threads trying to access the same resource, but that doesn't appear to be the case. Any ideas as to what the problem might be? I'm stumped as a new C# programmer. I read other questions where

Is there any event triggered when a new window is added to the desktop

岁酱吖の 提交于 2019-12-11 02:34:18
问题 I want to know whether there is any event triggered when a new window appears/comes on the desktop. I am open to using COM,WMI,WinApis, UIAutomation or any other method but the language of choice is C#. The actual requirement: A process has 1 main window and many other windows. The class name of one of the windows is, say, X, (i got this info using pinvoke). Now this window pops up some times whenever there is some notification in the process. I do not want to show this window. I do not have

call .net assembly from delphi (PSafeArray)

六眼飞鱼酱① 提交于 2019-12-11 02:32:39
问题 I have assembly written on .net Here is function from that assembly: public class OMG{ public Result[] test(){ var tmp = new List<Result>(); tmp.Add(new Result(){ var1 = 1, var2 = "test" }); tmp.Add(new Result(){ var1 = 2, var2 = "test1" }); return tmp.ToArray(); } } public class Result{ public int var1; public string var2; } So, i invoke this function from delphi. var tmp : PSafeArray; ... tmp:= omg.test(); So,here i get PSafeArray, how can i actually retrieve data? 来源: https://stackoverflow