com

Python win32com: Internet Explorer COM object ? (used to work?)

I have this very simple program: from win32com import client ie=client.Dispatch("InternetExplorer.Application") This used to work (I think I broke something when I re-used 'makepy.py' to try and add in constants for IE). It still works on another machine where I haven't been so slap-dash with 'makepy.py'. Here's what I get in an int...

Trying to do Office Automation with Excel 2007, but keeps using Excel 2003

Environment: Windows XP machine Both Excel 2007 and Excel 2003 installed (in that order, not chronologically). C# 3.5 Problem: When I use the PIAs to do some Office automation, I use the following line of code: var excel = new ApplicationClass(); The PIA's version specifically refers to it as Excel 12. C:\WINDOWS\assembly\GAC\Micro...

Trace not working in a .NET DLL loaded from VB6 EXE

Hello I have a .NET DLL that writes to the Trace. But seems that when I call my DLL from a VB6 EXE the trace is not working. I have created an myApp.config file in the EXE folder with the trace configuration, but this does not solves the issue. I've also tried creating the Trace objects in code,but doesn't work: Dim _traceSrc as Trace...

COMException in C# when hooking into event...

I am receiving a COM Exception when trying to hook into an event on a COM Object. Here is the code I am trying to execute. COMClass a = IComClass as ComClass; a.SomeEvent += new SomeEvent_EventHandler(MethodNameHere); Line two throws an exception of type COMException with the following information: System.Runtime.InteropServices.C...

How might I obtain an IShellFolder from the active IShellView?

I'm trying to enhance a CFileDialog, and we're using the older version of it (the non-vista one that doesn't use IFileDialog). The older one does allow me to obtain an IShellBrowser, as well as (from that) the active IShellView. What I cannot seem to come up with is a way to get "What IShellFolder does that IShellView refer to?" Equal...

.net regasm question

Lets say we have this scenario a setup that deploys a .net com dll and runs regasm on it, this setup has no uninstall so unregister Will never be called.. And you can run the setup over and over again.. Is there any danger in doing so?? What would happen if i deploy à new setup with à new version of the dll.. Is there any danger in n...

Using DirectX DLL (C++) from C#

I have a native C++ DLL using DirectX, that I want to be able to use through C# to be able to create content creation tools. Adding COM would require quite an effort it seems. Can P/Invoke be used to maintain classes using polymorphism, or would it require me to wrap most of the code to facilitate use of P/Invoke? It there a better sol...

Not correct page breaks if print from IE COM interface IWebBrowser

I have HTML document to print from embedded COM IWebBrowser object. And although in IE itself it printed with correct page breaks (by page-break-inside in CSS). In my application it make it wrong. I'm already dig it much. Can you suggest something? ...

How can I wrap a COM object in a native .NET class?

I'm using an extensive existing COM API (could be Outlook, but it's not) in .NET (C#). I've done this by adding a "COM Reference" in Visual Studio so all the "magic" is done behind the scenes (i.e., I don't have to manually run tlbimp). While the COM API can now be "easily" used from .NET, it is not very .NET friendly. For example, th...

Loading a Type Library via PowerShell and scripting Windows Live Writer

I'm very new to COM and Windows programming/scripting in general. What I was trying to do is scripting Windows Live Writer; according to the documentation before I can call $o = New-Object -c WindowsLiveWriter.Application I need to load the TLB first, so I should call the add-type command, unfortunately it fails: PS C:\Users\NoWher...

COM object that has been separated from its underlying RCW cannot be used.

I have some COM component which I call from some c# dll. I also have a winforms app that uses that .dll. When I close the app I get this exception: COM object that has been separated from its underlying RCW cannot be used. The stack trace shows this exception comes from a destructor in the .dll. I implemented this destructor ...

Catching SENS Events in .NET, no Guid Attributes

I'm following this article to registering SENS events via COM, but I think I'm missing something. I'm calling the SubscribeToEvents method the article says to write, like this: EventSystemRegistrar.SubscribeToEvents("ManagedSENS EventSubscriber", "ManagedSENS.SensLogonInterop", subscriptionViewerID, this, typeof(SensLogon)); which lea...

regsvr32 giving error : application configuration file incorrect , how to resolve ?

I have a .net dll which is actually a .NET wrapper for COM , i dont have source of it its third party , when i tried to register it using regsvr32 it gives error application configuration file incorrect , resintalling may resolve problem i checked with Dependency Walker all referenced dlls are loaded also VC++ run time dlls msvcm...

How do I ensure no re-entrant access to my main-STA COM server (C++)?

OK, I suspect I'm going to have difficulty even putting this in words since my understanding of COM and apartments isn't really up to the job ;-) I have a COM in-process server/component (C++) that wraps some legacy code. Due to the limitations of this legacy code I need to ensure that the methods of the COM component are: only called...

Running into a .NET COMException with MS Office Interop

I am trying to work with the Windows clipboard and Office Interop in an ASP.NET web application. Everything works well on my local machine running XP (i have created a Windows application first which ran perfectly well on local machine). Then I have executed it on a server running Windows Server 2003 and it worked there as well. Then I...

What's the Matlab equivalent of NULL, when it's calling COM/ActiveX methods?

Hi, I maintain a program which can be automated via COM. Generally customers use VBS to do their scripting, but we have a couple of customers who use Matlab's ActiveX support and are having trouble calling COM object methods with a NULL parameter. They've asked how they do this in Matlab - and I've been scouring Mathworks' COM/ActiveX...

Sending unicode mails via SMTP

I'm using CDO message class to send mails. How to set the content type to UTF-8. Currently I'm getting junk characters in the mail body. CComPtr<IMessage> piMsg; ...

Windows, getting CLSID for DLL?

I want to have a small app to add and remove user defined context menu entries from the registry. To make this somehow I need to get the CLSID of an arbitrary DLL so I can back up previous entries if they exist and then write new ones. Although regsrv32 somehow manages to create this magical number, I didn't find any answer with google. ...

Is .NET "all COM underneath"?

I've been an admirer of Juval Lowy's teaching and guidance in .NET development for a number of years. He's also written one of my favorite books: Programming .NET Components. However on a recent DotNet Rocks podcast (Jan 2010) in discussing WCF/COM and .NET, he made some comments that greatly surprised me: Juval Löwy: ..... in .N...

Retrieving dll version info via Win32 - VerQueryValue(...) crashes under Win7 x64

The respected open source .NET wrapper implementation (SharpBITS) of Windows BITS services fails identifying the underlying BITS version under Win7 x64. Here is the source code that fails. NativeMethods are native Win32 calls wrapped by .NET methods and decorated via DllImport attribute. private static BitsVersion GetBitsVersion() ...