COM interfaces methods can return various HRESULT values to signal invalid argument values passed. When do I return E_POINTER and when E_INVALIDARG?
As I understand if a method receives an index in an encapsulated collection and it is out of bounds that is E_INVALIDARG. If a method receives an Interface** pointer where it is meant to st...
On Vista using IE8, I have an instance of IWebBrowser2, which I am using to obtain the current HTML document:
IWebBrowser2* browser;
CComPtr<IDispatch> disp;
HRESULT hr = browser->get_Document(&disp);
When this is executed by an Administrator, the call succeeds. However, when called by a regular user, the call returns an error code of...
I have a native c++ app, and I want to use some managed types that are in a separate managed dll. I believe that one way to do this and still keep the c++ app totally native is to use COM interop with .NET. However my problem is that my app has to initially run on machines that don't have the CLR installed, so I don't want the CLR to be ...
I have a C# application which uses a COM component. This COM component require a message pump (Application.Run()) to do its processing. This means it's been stuck on the main thread. But I recently discovered that it's possible to start another Application.Run on another thread which gets its own ApplicationContext.
So I want to host...
Hi,
When creating COM interface declarations in C# are there any "rules" you have to stick to? I think there are and would like to get some info on it. For example I'm toying around with the ITaskbarList, ITaskbarList2 and ITaskbarList3 interfaces and it seems to me that I
Have to declare the order of the members in the manages implem...
I am referencing a COM library in Visual Studio, so it has automatically created the corresponding Interop assembly for me. I would like to do a GetType() on these com objects, but they always return System.__ComObject. Querying them for an interface works though:
bool isOfType = someComeObject is ISomeComObject; //this works
But what...
Hi,
What is the right way to compare two CComBSTRs? I tried to use
bool operator ==(
const CComBSTR& bstrSrc
) const throw( );
However it always return false even two ComBSTRs are the same. It did not work correctly.
Do I have to convert CComBSTRs to ANSI string first and then use strcmp?
Thanks!
-bc
...
Hey Folks,
I have a doubt. I initialize COM, do CoCreateInstance and use some interfaces.Can I call CoUninitialize without calling Release? Does it cause any memory/resource leak?
Thanks in Advance,
-Mani.
...
Using VS2003 (.Net 1.1) We have an MFC MDI application that spawns a C# window as a COM client.
We need to catch all user input within the application and we're currently using CWinApp::PreTranslateMessage() to catch the commands headed to the MFC windows but this obviously doesn't catch the messages headed to the C# window.
What is th...
Didn't quite get the following from MSDN:
ClassInterfaceType.None
Indicates that no class interface is
generated for the class. If no
interfaces are implemented explicitly,
the class can only provide late-bound
access through the IDispatch
interface. This is the recommended
setting for ClassInterfaceAttribute.
Usi...
I have a Win32 application that includes an EXE, an ActiveX control (DLL) and a COM server (EXE) and I am using Inno Setup 5 to build my installer. Many of our customers use limited user accounts where the user has no admin rights and because the COM components require to be registered (which writes to HKEY_CLASSES_ROOT), my setup file ...
I am writing some Internet Explorer automation scripts using PowerShell. Here is how I start the IE com object:
$ie = New-Object -com "InternetExplorer.Application"
$ie.Navigate("about:blank")
$ie.visible = $true
$doc = $ie.Document
So, what I would like to do is to execute some javascript on the $doc object. For example, I have an i...
I have generated an ATL COM object using VS2008 and the code contains references to a definition called _MERGE_PROXYSTUB (because I chose the 'Merge proxy/stub' option when I initially ran the wizard.)
What is the point of a proxy/stub? If I don't select the the merge option then I get a separate MyControlPS.DLL instead - when would th...
Hello,
I have created a tool that imports an excel sheet. The excel COM object is created during the lifetime of the app. I have applied the MVP pattern to my tool so that VIEW and Presenter are seperating the UI and logic.
The vIEW that is a WinForm is having a Dispose() method due inheritance from From class, which is overriden in th...
I just finished building my new COM project (C#, .NET 3.5). This project will be called by a VFP application. It's working great on my development machine, but now I need to know how to deploy it on the user's machine. Click Once isn't available for this kind of project, so I guess I'm stuck with manually distributing the DLL.
So, where...
I'm a COM newbie and I think what I have is correct, but the runtime doesn't like it. Any help is much appreciated.
I need to invoke a COM function that takes in a single dimensional array of BSTRs. Specifically, the documentation says the parameter must be:
Function: AddFiles ( [in] VARIANT * filePaths )
filePaths The sing...
Hello
I have IWebBrowser2 ctrl embedded into my own dialog. I want to simply
display a promo banner within it from my url. How to disable all popup
menu items from the control and force it to open links in new window
(currently when I click on link in the banner, it is being opened
within the same control).
Regards
Dominik
...
Is it possible to load an OCX component for one application from a different location than the system default without unregistering the one in the System32 directory with regsvr32? Two applications are having conflicts with an OCX component.
...
If I have a C++ class, X, which implements the COM interfaces IY and IZ, and I have a pointer y to the IY interface of an object of type X, and I do this:
IZ *z = dynamic_cast<IZ *> ( y );
That doesn't bump the object's reference count, does it? I don't have to do a Release() to account for it, right?
If it matters, I'm using ATL/COM...
I am trying to retrieve Tiff image data through COM using a StringBuilder but the buffer only has a length of 3 after the COM call. I am converting a VB.NET version to C# which uses a String instead of StringBuilder and is working just fine. If anyone has any suggestions or can point me to some good reading material I would appreciate ...