com

VirtualBox COM API from C#

I am trying to use the VirtualBox COM API (VBoxC.dll) from C#. I ran tlbimp VirtualBox.tlb against the typelib included in the VirtualBox SDK. Referencing the output assembly builds OK but at runtime I get a SafeArrayTypeMispatchException ("Specificed array was not of the expected type") whenever I try to access properties that retur...

Restricting WinForm application to one process with multiple instances

We have a WinForms application in C# 3.5 (SP 1). We would like to restrict the application to one process in memory with multiple window instances. We are not looking for an MDI approach, but to have separate main form instances without launching multiple application processes. We are evaluating three approaches: Windows Messages C...

How do I use AfxOleGetMessageFilter in a VB .NET program?

Hi. We have a program that calls a long-running (SolidWorks) API function. After a while, we get an error dialog saying that "the COM server is busy...". We've done some research and have found that you can control this by using a bit of C++ code similar to: COleMessageFilter *pFilter = AfxOleGetMessageFilter(); if(pFilter) ...

Advise HTMLElementEvents2 sink (MSDN website)

From the msdn website void CMyClass::ConnectEvents(IHTMLElement* pElem) { HRESULT hr; IConnectionPointContainer* pCPC = NULL; IConnectionPoint* pCP = NULL; DWORD dwCookie; // Check that this is a connectable object. hr = pElem->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC); if (SUCCEEDED(hr))...

Bad idea to have the same object, have a different side effect after method call.

Hi all, I'm having a bit of a gesign issue(again). Say I have this Buttonpad object: now this object is a wrapper object over one in a com object. At the moment it has a method on it called CreateInto(IComObject). Now to make a new button pad in the Com Object. You do: ButtonPad pad = new ButtonPad(); pad.Title = "Hello"; ...

Get an audio session's volume level

Does anyone know how to get the current volume level of an audio session* in Vista or 7? I've got the IAudioSessionControl2 and IAudioSessionManager2 instances you need to listen for volume changes, but actually getting the current volume is proving elusive. *by audio session I mean (roughly) the per-application audio control, not the ...

Following a javascript postback using COM + IE automation to save text file

Hi, I want to automate the archiving of the data on this page http://energywatch.natgrid.co.uk/EDP-PublicUI/Public/InstantaneousFlowsIntoNTS.aspx, and upload into a database. I have been using python and win32com (behind a corporate proxy, so no direct net access, hence I am using IE to do so) on other pages to do this. My question is...

Possible gotchas of embedded FlashPlayer?

I'm using embedded FlashPlayer in windows forms application. I'd like execute action script functions from C# passing unicode strings as arguments. According to adobe to invoke actions script function one should call CallFunction with a string that contains xml request. But they didn't say anything about character encoding of the xml re...

Configuration files with COM

I have an old PowerBuilder application that we are slowly phasing out. We are also moving to a more service orientated. So in order to facilitate this we are using C# COM wrappers to call WCF methods so old direct SQL calls can be slowly removed. We also use the C# COM wrappers when need functionality is needed in the power builder appli...

Implementing the IExtractImage COM interface

I see a lot of references to IExtractImage when researching how to generate thumbnails in explorer, and I cannot use the new API which is Vista/7 only as the target OS is XP. Almost all the results I've found talk about using IExtractimage to acquire thumbnails, not implementing IExtractImage to create them. I don't want to retrieve thu...

ID3DX10Mesh and ID3DXMesh Guids EXACTLY the same

I'm doing C# interop with Direct3D (I know about SlimDX and XNA so let's not get into the merits of this) and I'm calling D3DX10CreateMesh passing it my ID3DX10Mesh interface. I'm getting an error saying "No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))". The D3DX10CreateMesh call comes while I am trying t...

System.ArgumentException: VariantWrappers cannot be stored in Variants.

I have a COM object which has the following type def (as seen by OleView): [id(0x60030010)] HRESULT Calc( [in] BSTR calculation_type, [in] short pricing_model, [in] BSTR option_type, [in] double strike, [in] double spot, [in] double P1, ...

Can I get proper IDispatch from DISPPARAMS?

I want to get a proper IDispatch pointer then cast it to CMyDispatch pointer and have my way with it later. i.e. in javascript I want to do something like this: var x = external.obj.x; var y = external.obj.y; external.obj.x = y; where x and y are instances of CMyDispatch. CMyDispatch is returned to javascript this way: STDMETHODIMP...

C# component events?

I am attempting to write a C# component which will expose events. The component is to be imported by an unmanaged C++ application. According to a few tutorials I have come up with this code (for the C# side): namespace COMTest { [ComVisible(true), Guid("02271CDF-BDB9-4cfe-B65B-2FA58FF1F64B"), InterfaceType(ComInterfaceType.InterfaceIsID...

Removing (or updating) an image from RichTextBox

I have a question related to managing OLE objects in a RichTextBox. What I've found so far is lots of info, but not exactly what I need, so I will make a quick introduction first (I also hope someone might find this helpful). 1. What I know so far First of all, I am using OLE to insert images (or any ActiveX) into the RichTextBox. Thi...

unresolved external symbol ...QueryInterface

...

How can I easily use a COM component in Native Visual C++

Hi there. I am trying to build an app that uses a COM component in VisualStudio ´05 in native C++. The mix of native and managed desciptions of things in the MSDN totally wrecked my brain. (I think the MSDN is a total mess in that respect) I need a short and simple native C++ sample of code to load my Component and make it usable. I am ...

32-bit crypt component running on 64-bit server with 32-bit IIS app!

I've got a Classic ASP application running on 64-bit Windows Server 2003 in 32-bit emulation on IIS. I'm bringing a COM component over from a 32-bit server and wondered how I would install that to be accessible from the Classic ASP app. I can choose between a 64-bit and a 32-bit version of the component. Do I: install the 32-bit ...

How to debug "Wrong number of arguments or invalid property assignment" vbscript .NET interop

I have a .NET assembly, written in C#. It's marked ComVisible, has a guid, is signed, regasm'd (/codebase). I did not formally define an interface for the COM part. I use this assembly via VBscript. There's an overloaded method - one form takes a single string argument, and the second takes two strings. Both return another .NET type...

How to check the class id is registered or not?

Hi i am checking the GUID of SqlClass which is in my Test.dll But it does not give success it failed with value... Whatis wrong in this code. #include <windows.h> #include <iostream> using namespace std; int main() { HKEY hk; long n = RegOpenKeyEx(HKEY_CLASSES_ROOT,TEXT("\\CLSID\\SqlClass"), 0,KEY_QUERY_VALUE, &...