com

NoSuchPortException when running java application using SMSLib

喜欢而已 提交于 2019-12-10 22:18:19
问题 I'm using SMSLib in my java application to send an SMS , i connect a USB internet modem to my PC then determine it's port number (ie. COMx) then creating a serial modem gateway like this : determining the port number : creating the gateway: SerialModemGateway gateway = new SerialModemGateway("mobile", "COM5", 115200, "Apple", "iPhone"); but whether i define the port as COM4 or as COM5 it runs the connection at first then gives me that following exception then stops the service by the usual

Difference between two different types of assigning events to event handlers

我的未来我决定 提交于 2019-12-10 21:39:16
问题 I saw this sample code in SO that was saying one practice is bad and the other one is good. But I don't understand why? As a matter of fact I am getting that famous RCW COM object error and that post was saying this could be a reason. public class SomeClass { private Interop.ComObjectWrapper comObject; private event ComEventHandler comEventHandler; public SomeClass() { comObject = new Interop.ComObjectWrapper(); // NO - BAD! comObject.SomeEvent += new ComEventHandler(EventCallback); // YES -

Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)

廉价感情. 提交于 2019-12-10 21:09:17
问题 Using .Net 4.0 / WPF Application / C# I have the following piece of code in my application, which opens a FileDialog when the Select button is clicked. OpenFileDialog fdgSelectFile; bool? dialogResult; try { fdgSelectFile = new OpenFileDialog {DefaultExt = FileDialogDefaultExt, Filter = FileDialogFilter}; dialogResult = fdgSelectFile.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { SelectedFilePath = fdgSelectFile.FileName; // do your stuff } } This piece of code works in

Passing DataTable over COM into R

懵懂的女人 提交于 2019-12-10 20:47:20
问题 I am trying to pass data from SQL, to C#, then to an R server for data analysis then back to my web application; however, the COM interface that I am using does not allow complex data types to be passed between C# and R (no data tables). I have gotten it to work in the past by using the following code: int count = dataTable.Rows.Count; object[] y = new object[count]; object[] x = new object[count]; //R does not accept DataTables, so here we extract the data from //the table and pass it into 2

How to find COM interface definition for given interface GUID?

半世苍凉 提交于 2019-12-10 20:33:54
问题 I have a COM interface GUID but I don't know that interface definition. I don't know what methods it has, what parameters they have and so on. How can I obtain such information? Is it possible in general? Practical problem is obtaining interface definition for few COM interfaces defined in actxprxy.dll . For example IFileDialogPrivate ( {AC92FFC5-F0E9-455A-906B-4A83E74A803B} ). (Obviously the interface is not documented and the name does suggest there is a reason for that.) I tried to use OLE

In a VS 2015 extension, how can I get the selected object in the Solution Explorer?

你离开我真会死。 提交于 2019-12-10 20:16:57
问题 I'm interested in getting a Project or ProjectItem (as examples, not limited to those two) for the current selection where only a single item is selected. Most people seem to be using IVsMonitorSelection to get an IVSHierarchy and then use the following to get the object for the selected item (in case of a single item being selected): var monitorSelection = (IVsMonitorSelection) Package.GetGlobalService(typeof(IVsMonitorSelection)); IntPtr hierarchyPointer, selectionContainerPointer; uint

How to hook up a COM event dispatcher?

孤人 提交于 2019-12-10 19:58:07
问题 The VBIDE API exposes the wonderfully cryptic _dispVBComponentsEvents interface (among others), which look like something that I could use to capture various interesting events in the VBE. So I implemented the interface in a class that intends to capture the event and raise a "normal" .net event for the rest of my application to handle, like this: public class VBComponentsEventDispatcher : _dispVBComponentsEvents { public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentAdded;

Is it necessary to call Marshal.ReleaseComObject in C#4 when doing COM?

谁都会走 提交于 2019-12-10 19:48:22
问题 I have VS2010 and added a reference to a COM library to my project and VS embedded a primary interop inside the project. If I reference objects from the COM library and I want to dispose of them quickly without waiting for the GC, is it needed to call ReleaseComObject ? 回答1: Marshal.ReleaseComObject provides a way to immediately drop references to this COM object from everywhere it is being consumed within managed code (because it releases the underlying IUnknown from the RCW that is holding

Specialize a template for a GUID value

旧街凉风 提交于 2019-12-10 19:39:52
问题 This is a follow up to Why aren't fields from constant POD object constants themselves? A header from a library declares class GUIDs like static const GUID CLSID_EH264VD = { 0x96b9d0ed, 0x8d13, 0x4171, { 0xa9, 0x83, 0xb8, 0x4d, 0x88, 0xd6, 0x27, 0xbe } }; I want to write a function that creates an object directly from the dll, without requiring the dll to be registered, so I need to map each CLSID to the dll name. Something like Create<CLSID_EH264VD>() which would depend on a specialization

COM Component Registration during .NET Setup Project

做~自己de王妃 提交于 2019-12-10 19:33:01
问题 I have a project which uses a COM Component from Microsoft, which doesn't come with the system, and the default setup of this COM Component only installs the samples, it does not run regsvr32 on the component to make it available via add reference or for that matter, helping the CLR find the DLL. The application I'm shipping uses this DSOFile sample to edit OLE file properties. It's for internal purposes. How do I add a native component to a setup project and have the wizard run the correct