com

MSHTML HTMLHeadElementClass COM Error

≯℡__Kan透↙ 提交于 2019-12-09 02:04:38
问题 I'm currently working with MS HTML to insert a JavaScript code into websites. I made a reference to Microsoft HTML Object Library and types this code. IHTMLDocument2 doc = BrowserHost.Document as HTMLDocumentClass; IHTMLElement head = (IHTMLElement) ((IHTMLElementCollection)doc.all.tags("head")).item(null, 0); IHTMLScriptElement scriptObject = (IHTMLScriptElement)doc.createElement("script"); scriptObject.type = @"text/javascript"; scriptObject.text = TTS.TTSWebFactory.GetJavascript(); (

Creating an ATL COM object that implements a specific interface

心不动则不痛 提交于 2019-12-09 01:31:45
问题 I need to implement a simple ATL COM object that implements a specific interface for which I have been given both a .tlb file and a .idl file. The interface is very simple and only consists of a single method. I have created many ATL objects in the past but never one that has to implement a specific interface. What do I need to achieve this? I'm assuming that I somehow need to reference the interface's IDL or TLB in my new objects IDL somewhere? Any pointers are welcome. 回答1: It's much more

What do the different DCOM / COM security settings mean?

你离开我真会死。 提交于 2019-12-08 23:45:00
问题 Our application uses COM and DCOM extensively, and so as part of that we need to ensure that the COM security permissions are correctly set up. I know that I can access these permissions under the Component Services MMC snap in and that I can set the defaults / limits under the property pages for the Computer And that under the DCOM Config node I can drill down and set securty permissions for individual applications I also understand the relationship between the "Defaults" (what DCOM

DispID must be unique across interfaces?

末鹿安然 提交于 2019-12-08 21:06:52
问题 I use COM with an old VB6 application. I changed my code to use DispID in interfaces as it seems to work better than using [ClassInterface(ClassInterfaceType.AutoDual)] . But is it allowed to begin in each interface counting from DispID(1), even when a class uses two interfaces? Does it work this way stable? Or do I missunderstood something? [ComVisible(true)] [Guid("9E1125A6-...")] public interface IMyInterface1 { [DispId(1)] string Name1 { get; } } [ComVisible(true)] [Guid("123425A6-...")]

Passing pointer from managed C++/CLI to ActiveX C++ component

一笑奈何 提交于 2019-12-08 20:58:26
I have an ActiveX component built in C++. One of its methods has this signature: short Component::Method(short FAR* ptr) {} When the I add the ActiveX into my C++/CLI application the method signature shows as: short Compnenet::Method(short% ptr) {} I want to be able to correctly pass short* pSomething; variable value to this method. of course, the new signature doesn't accept passing arguments as short* and even if you try to cast to short% it doesn't give right results. Note: I don't have access to the activeX control to change. I can only confirm the value of address that that the activeX

IGraphBuilder::RenderFile() failing with VFW_E_BAD_KEY - 0x800403f2

Deadly 提交于 2019-12-08 20:02:42
Continuing investigation on a embedded WindowsMediaPlayer problem , i am trying to do simple file playback via a DirectShow in-process server: ::CoInitializeEx(0, COINIT_MULTITHREADED); CComPtr<IGraphBuilder> spGraph; spGraph.CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC_SERVER); CComQIPtr<IMediaControl> spMediaControl(spGraph); // ... later: spGraph->RenderFile(L"c:\\foo.wav", 0); // fails with VFW_E_BAD_KEY spMediaControl->Run(); Interestingly, this runs fine on both systems i tested on (Windows XP 32 & x64) when doing it in a stand-alone application. It however fails in my real use

How do I access services of UPnP device?

妖精的绣舞 提交于 2019-12-08 19:59:06
问题 The device: Belkin Wemo Switch Dev environment: MS VC++ 2010 on Windows7 I'm trying to enumerate the services of a UPnP device using C++ from Windows. I've got the IUPnPDevice pointer and can access several properties. I've got the IUPnPServices pointer and can count the correct number of services (7). I use QueryInterface() to get the IEnumVARIANT pointer (which appears to succeed). However, the Next() method always fails with HRESULT of 0x80040500 - which translates as Windows error 1280

c# how to convert IntPtr to struct?

放肆的年华 提交于 2019-12-08 19:39:45
问题 A simple ATL com server: STDMETHODIMP CMyMath::get_Version(sVersionStruct **ppVer) { sVersionStruct* pVer = reinterpret_cast<sVersionStruct*>(CoTaskMemAlloc(sizeof(sVersionStruct))); if (!pVer) { return E_OUTOFMEMORY; } else { *pVer = ver_; *ppVer = pVer; return S_OK; } return S_OK; } STDMETHODIMP CMyMath::put_Version(sVersionStruct* ver) { ver_ = *ver; return S_OK; } idl definition: typedef [ uuid(72A4AA5B-6AD0-4249-B4CB-2FFB08301608) ] struct tagVersionStruct { int majorVersion; int

How does a COM server marshal nullable in C# class library with different ComInterfaceType Enumerations?

六眼飞鱼酱① 提交于 2019-12-08 18:32:06
问题 I hear that Nullable<T> is a C# generic class and it does not work with COM - like any other generic class. Well, in my C# class library I have: [InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("2FCEF713-CD2E-4ACB-A9CE-E57E7F51E72E")] public interface ICOMClass { int? GetNullable(); } [ClassInterface(ClassInterfaceType.None)] [Guid("57BBEC44-C6E6-4E14-989A-B6DB7CF6FBEB")] public class COMClass : ICOMClass { public int? GetNullable() { int? hello = null; return hello; } } Surprisingly

Calling NetValidatePasswordPolicy from C# always returns Password Must Change

此生再无相见时 提交于 2019-12-08 17:34:28
问题 We have a mvc application that is using Active Directory to authenticate our users. We are leveraging System.DirectoryServices and using the PricipalContext to authenticate: _principalContext.ValidateCredentials(userName, pass, ContextOptions.SimpleBind); However this method only returns a bool and we want to return better messages or even redirect the user to a password reset screen for instances like: The user is locked out of their account. The users password is expired. The user needs to