com

mutex lock in Nant

How do i implement Mutex lock in Nant, the reason why i need this feature is because i register COM components in order to get my build working , and then end of the build i Un Register the COM components. without mutex lock, different version of COM are registered and face some issues. so it would be better if we apply mutex lock i...

What values to return for S_OK or E_FAIL from c# .net code?

I'm implementing a COM interface that should return int values either S_OK or E_FAIL. I'm ok returning S_OK as I get that back from another call (Marshal.QueryInterface), but if I want to return a failure value what actual value do I use for E_FAIL? (It's such a basic fundamental question that it's hard to find an answer to) Assuming i...

How do you register a win32 com dll in WiX3?

So I found this example on registering DLLs: http://blogs.msdn.com/robmen/archive/2004/04/28/122491.aspx and WiX complains about the "AssemblyRegisterComInterop" attribute. I removed that and changed the "Assembly" attribute to win32 and it says I need to specify the AssemblyManifest attribute, but I don't know what to put there. ...

Is it possible to test a COM-exposed assembly from .NET?

I have a .NET assembly which I have exposed to COM via a tlb file, and an installer which registers the tlb. I have manually checked that the installer works correctly and that COM clients can access the library. So far, so good... However, I am trying to put together some automated system tests which check that the installer is working...

Making a C#-based Excel add-in run out-of-proc with minimal pain.

Hi, I have developed a prototype C# Excel 2003 add-in in VS2005 that supports an object with some simple calls, plus a separate RTD class, all sitting atop a large existing in-house C# stack. It all works fine as-is, but... I'm told that in order to avoid potential conflicts with other Excel add-ins that might want a different .Net ru...

Can I detect errors while using a .Net WebBrowser control?

I have an .Net Froms application that displays web pages through a WebBrowser control. Is there anyway that I can detect if the control shows a 'Page not found' or 'Cannot display webpage' error? There doesn't seem to be any error event handlers. ...

Connecting to WMI: 0x800706ba errors on some machines (but not all)

When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable). If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of firewall settings,...

How to debug COM object in Visual Studio 6.0 that is created in an ASP page?

I have an old C++ COM component which has to stay in Visual Studio 6.0 format. I can't for the life of me figure out how to debug the code in the actual COM component. I'm able to build it in debug mode, add breakpoints and attach it to the dllhost.exe process, but the Visual Studio environment will only show me the disassembly from dl...

How to extract the picture in the img element in a webcontrol host ?

I would like to extract a bitmap from an html page. I expected to find a IStream, IPersistStream or IPersistStreamInit from the IHTMLImgElement I got in the web page. However I can't found any of those. I could read the picture from the cache but this is somewhat unreliable and I would like to avoid reading from the filesystem. Is ther...

Active Directory authentication

I have a c# class which uses the WindowsIdentity namespace to return details of the current Active Directory user. This is accessible through a web part on SPS and sure enough returns the desired record values specific to that user. I have a classic ASP application which I would like to have inherit this functionality. After wrapping ...

C# COM DLL - do I use REGASM, or REGSVR32?

I am building a C# ActiveX DLL... do I use REGASM or REGSVR32 to register it? How do I register the 64-bit interface vs the 32-bit interface? ...

GC contains lots of pinned objects after a while.

I have a strange phenomenon while continuously instantiating a com-wrapper and then letting the GC collect it (not forced). I'm testing this on .net cf on WinCE x86. Monitoring the performance with .net Compact framework remote monitor. Native memory is tracked with Windows CE Remote performance monitor from the platform builder toolkit...

Can't instantiate a COM object written in C# from VBA (VB6 ok)

Using VS 2008, here is my COM object using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; namespace TestCom { [Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("Test9.COMINT")] public cl...

Call to a method never returns

I am working with a COM component. There is a method that does this call to the component, and this method is used many times in my application, for each document to be processed, this method is called. One weird thing happens sometimes suddenly, doesn't matter the amount of documents processed, it can happen after processing 60, 100 or...

Defining a pure base class using IDL

When I define an interface in IDL which does not derive from anything, the MIDL precompiler warns as such (Visual C++ 2008) : warning MIDL2271 : [object] interfaces must derive from another [object] interface such as IUnknown (...) And if I derive my interface from another which does not derive from IUnknown, MIDL fails : error ...

Can someone explain the c++ FAILED function?

I've seen a lot of example c++ code that wraps function calls in a FAILED() function/method/macro. Could someone explain to me how this works? And if possible does anyone know a c# equivalent? ...

Why is my WM_UNICHAR handler never called?

I have an ATL control that I want to be Unicode-aware. I added a message handler for WM_UNICHAR: MESSAGE_HANDLER( WM_UNICHAR, OnUniChar ) But, for some reason, the OnUniChar handler is never called. According to the documentation, the handler should first be called with "UNICODE_NOCHAR", on which the handler should return TRUE if you...

Serial port communication in VC++

when reading data through serial port VARIANT data; BSTR k; if(m_mscom.GetCommEvent() == 2) { data = m_mscom.GetInput(); k = data.bstrVal; } What is BSTR k; and what do you mean k=data.bstrVal? What is bstrVal? ...

Passing optional arguments to a COM function in VC++

I have an MFC wrapper over a COM object. There is a function that takes a large number of options, which are mostly optional. How do I pass some arguments but not others? For what it's worth, the optional arguments are listed as VARIANT*. Below is the code CComVariant vFalse = false; CApplication application; { application.Cr...

How to preserve COM DLL version in an auto-generated interop assembly in VS2005?

I've added a reference to a co-worker's COM DLL -- MyLogic.dll -- to my C# project in Visual Studio 2005. As expected, this auto-generates Interop.MyLogicLib.dll in my output folder. However, the version number of the COM DLL is 2.1.0.180, whereas the version number of the auto-generated interop assembly is 1.0.0.0. How do I get Visual S...