com

C# interop - validate object exists

I would like to use a COM object in my application. How can I make sure the object is registered in the machine? The only solution I found (also on SO) was to use a try-catch block around the initialization: try { Foo.Bar COM_oObject = new Foo.Bar(); } catch (Exception ee) { // Something went wrong during init of COM object }...

How to pass 2 string lists to c++ from c# through COM?

Hi I need to pass string lists to unmanaged c++ how can i do this ?? I have used IDictionary as method return type and send through com but it doesn't work How to achieve this. i write in c# as follows IDictionary postNames() { IDictionary post=Dictionary(); post.Add("Raj"); post.Add("Mahesh"); post.Add("john steek"); return...

Memory leak using WMI in Delphi 7

I'm experiencing a memory leak when using WMI from Delphi 7 to query a (remote) pc. The memory leak only occurs on Windows 2003 (and Windows XP 64). Windows 2000 is fine, and so is Windows 2008. I'm wondering if anyone has experienced a similar problem. The fact that the leak only occurs in certain versions of Windows implies that it mi...

Delphi App Communicates with Program That Ends Up Crashing Occasionally - Vendor Blames My Delphi App

I've written a Delphi DLL that communicates with a third party program via COM. Some users report that the third party program crashes occasionally. Others using the software in an identical fashion have never experienced a crash. When this crash occurs, the third party program appears to simply become unavailable in my DLL app. The ...

Can I use Win32 COM to replace text inside a word document?

I have to perform a large number of replacements in some documents, and the thing is, I would like to be able to automate that task. Some of the documents contain common strings, and this would be pretty useful if it could be automated. From what I read so far, COM could be one way of doing this, but I don't know if text replacement is s...

detect client process termination from EXE COM Server

I'm writing an EXE COM Server that exposes a class that lock a system resource. In normal execution the client release the resource (the COM executable shutsdown a couple of seconds later. In abnormal execution, the client app crashes, leaving the com sever with an instance having a positive reference count. The COM executable runs for ~...

Create instance of COM class dynamically in .NET

I can load COM DLLs that are registered on my machine like this: Type type = Type.GetTypeFromProgID("MYCOMDLL.ClassName"); object boxed = Activator.CreateInstance(type); I can then poke around invoking methods etc. How can I achieve this from a DLL file that is not registered on my machine? Something like this magicode: Type type =...

Windows 7 & VB Classic Code: Any runtime issues?

Microsoft has promised that VB6 code will continue to work on Windows 7, but has anyone noticed any gotchas specific to running VB6 code in the Windows 7 RC? And for that matter, any issues with COM objects and ActiveX controls outside of VB6? I remember Microsoft saying that they'll ensure THEIR controls continue to work and end it at...

How can I tell what module my code is executing in?

For a very long time, when I have an error handler I make it report what Project, Module, and Procedure the error was thrown in. I have always accomplished this by simply storing their name via constants. I know that in a Class you get the name programmatically with TypeName(Me), but obviously that only gets me one out of three pieces o...

PHP new COM("word.application") SaveAS causes "Disk is Full" Error

Hello, I have a PHP script running on XAMPP in Windows XP that will open a .doc file and then save it as a different copy. This was working fine earlier on, but out of nowhere the error message keeps appearing. $path = "c:/xampp/htdocs/"; com_load_typelib('Word.Application'); $word = new COM("word.application") or die("Unable to instan...

Strange exception when calling code in a web service vs a windows exe

I'm interoping with some com objects in a web service using code shared with a windows app. The window apps has no problems interoping with the com objects but the web service throws this exception 'Type 'MapShots.FODDs.ilfFOD.fodDescriptions' in Assembly 'ilfFOD, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null' is not marked as...

Excel interop: _Worksheet or Worksheet?

I'm currently writing about dynamic typing, and I'm giving an example of Excel interop. I've hardly done any Office interop before, and it shows. The MSDN Office Interop tutorial for C# 4 uses the _Worksheet interface, but there's also a Worksheet interface. I've no idea what the difference is. In my absurdly simple demo app (shown belo...

Outlook 2002 Issues Saving an Embedded Post

I'm writing an Outlook COM addin using C++/ATL. I'm getting a rather odd set of errors and results back from Outlook when I call _PostItem::SaveAs. This only occurs in Outlook 2002 (Outlook XP) and only when the _PostItem is an embedded item (an attachment of some other outlook item). If the Post is an HTML type, it fails with E_INVALI...

Is there any COM library for Java that works well?

I'm rewriting a script that uses COM to automate a windows application, and I'd like to rewrite it in Java. The thing is, the COM libraries seem a little outdated, and I don't want to waste time with code that doesn't work. Is there anything you tried and worked? ...

using STAThread on ArcFM license

I am trying to use ArcFM with my ArcGIS project, and I've noticed a bug. If my main thread is marked with the [STAThread] attribute, the program hangs on exit with the OS Loader Lock exception. When I remove that attribute the program ends just fine. The following code hangs [STAThread] private static void Main() { MMAppInitialize m...

How to return collection objects from c# and Access them in c++?

Hi i have tried returning a collection of objects from c# and access them usig c++ via COM but failed.I have tried for List ArrayList and IDictionary all and failed. i have tried http://stackoverflow.com/questions/1032060/how-to-return-a-collection-of-strings-from-c-to-c-via-com-interop also but not succeed. can any body Help me ...

Consuming Python COM Server from .NET

Hi all, I wanted to implement python com server using win32com extensions. Then consume the server from within the .NET. I used the following example to implement the com server and it runs without a problem but when I try to consume it using C# I got FileNotFoundException with the following message "Retrieving the COM class factory for...

One accessor method returing a VARIANT or several returning distinct types?

I have a COM interface and need to add an accessor method to it. The returned value can actually be of one of 4 types: VARIANT_BOOL, long, BSTR or an IDispatch derived interface. I therefore have a choice: either I return a VARIANT or I have 4 different access methods that return distinct types. interface IValue1 { HRESULT GetType...

log parser error

Hi Guys, I have never used log parser before.. well I am getting this error now.. i don't know the reason.. Retrieving the COM class factory for component with CLSID {8CFEBA94-3FC2-45CA-B9A5-9EDACF704F66} failed due to the following error: 80040154. can ya help me out with this.. :) ...

Legacy VB6 COM+ DLL calling into native Win32 DLL -- threading issues with STA?

Hi all, Come across what looks at first sight like an MT-issue, but I'm trying to understand in detail the STA model used by COM+. Effectively, I have a legacy COM+ component, written in VB6, that calls into a native (i.e., not-COM) Win32 DLL written in C++. Having some intermittant (and impossible to reproduce in testing) problems wi...