com

C# - Hook into existing COM object

試著忘記壹切 提交于 2019-12-21 02:42:21
问题 Say we have an existing process (or application) that calls a COM object from an ocx file such as "MyCOMLibrary.ocx". Is there a way to write a C# library to exactly replicate the ocx file? So that the original application can call your C# code rather than the original COM object? You would, of course, have to use identical CLSID and ProgIDs as the original ocx. And assuming there is no signing involved, such as a SNK in the .Net world. Also, are there any tools that exist to automate this?

How to build a SAFEARRAY of pointers to VARIANTs?

你。 提交于 2019-12-21 02:38:11
问题 I'm trying to use a COM component with the following method: HRESULT _stdcall Run( [in] SAFEARRAY(BSTR) paramNames, [in] SAFEARRAY(VARIANT *) paramValues ); How can I create in C/C++ the paramValues array? 回答1: Adding to the answers above for reference by future readers: In IDL, SAFEARRAY(...) means a pointer to an array descriptor. But in C++, SAFEARRAY means an array descriptor. So IDL's SAFEARRAY(...) is really C++'s SAFEARRAY * . This confused me to no end. To make things even more

Is there a tool like Reflector for COM libraries?

笑着哭i 提交于 2019-12-20 23:49:49
问题 Is there a tool like Reflector for COM libraries? I would like to open a COM library and browse the classes and interfaces just like in Reflector. I would rather not install Visual Basic 6.0 in order to do this, if possible. 回答1: Not in the same way however there are number of tools that allow you to examine the type library. For example OleView. You can also get a good idea of the types inside COM library by simply adding it to a .NET project. You can then use object browser to browser the

How to diagnose cause, fix, or work around Adobe ActiveX / COM related error 0x80004005 progmatically?

删除回忆录丶 提交于 2019-12-20 23:26:52
问题 I've built a C# .NET app that uses the Adobe ActiveX control to display a PDF. It relies on a couple DLLs that get shipped with the application. These DLLs interact with the locally installed Adobe Acrobat or Adobe Acrobat Reader installed on the machine. This app is being used by some customer already and works great for nearly all users ( I check to see that the local machine is running at least version 9 of either Acrobat or Reader already ). I've found 3 cases where the app returns the

Why does authenticating against LDAP with DirectoryEntry intermittently throw COMException (0x8007203A): “The server is not operational”?

故事扮演 提交于 2019-12-20 23:08:12
问题 If anybody has a similar story, please post details below! I'm building an ASP.NET website which needs to support authentication against LDAP. On windows, LDAP auth can be performed via Active Directory (I'm no expert, but AD seems to simply be a particular flavor of ldap). I don't control the AD and/or LDAP servers. I've tried various methods of authentication, but I've settled on using a single DirectoryEntry per authentication attempt: using (DirectoryEntry de = new DirectoryEntry(ldapPath

How to Create an Outlook Plugin using Delphi?

人走茶凉 提交于 2019-12-20 19:47:02
问题 I'm working on a database project and I need to create Outlook 2007 plugin that saves the current previewed message into my database. Can someone give me a step-by-step guide on how to create an Outlook plugin in Delphi, and how to deploy it? Thanks 回答1: If you just want to learn and understand how to do it, just google for Delphi Outlook addin (I'm pretty sure "addin" should give you much more relevant results than "plugin" in this context) and you should come up with a number of slightly

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

折月煮酒 提交于 2019-12-20 18:29:27
问题 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. 回答1: The WebBrowser windows forms control is wrapper around Internet Explorer and it doesn't expose all the functionality of the underlying ActiveX control and particularly the NavigateError event. Here's a workaround: First add reference to

How to get system image list icon index of an IShellItem?

半腔热情 提交于 2019-12-20 15:09:13
问题 Given a Windows Vista or newer IShellItem , how do i get the system image list icon index associated with that item? For example (pseudo-code) : IShellItem networkFolder = SHGetKnownFolderItem(FOLDERID_NetworkFolder, 0, 0, IShellItem); Int32 iconIndex = GetSmallSysIconIndex(networkFolder); Int32 GetSmallSysIconIndex(IShellItem item) { //TODO: Ask Stackoverflow } Background In the olden days (Windows 95 and newer), we could ask the shell to give us the system imagelist index for an item's icon

How to get system image list icon index of an IShellItem?

独自空忆成欢 提交于 2019-12-20 15:08:03
问题 Given a Windows Vista or newer IShellItem , how do i get the system image list icon index associated with that item? For example (pseudo-code) : IShellItem networkFolder = SHGetKnownFolderItem(FOLDERID_NetworkFolder, 0, 0, IShellItem); Int32 iconIndex = GetSmallSysIconIndex(networkFolder); Int32 GetSmallSysIconIndex(IShellItem item) { //TODO: Ask Stackoverflow } Background In the olden days (Windows 95 and newer), we could ask the shell to give us the system imagelist index for an item's icon

COM / OLE / ActiveX / IDispatch confusion

和自甴很熟 提交于 2019-12-20 14:10:31
问题 I can't wrap my head around the differences among these terms. Are COM and ActiveX synonyms? Is ActiveX object just a COM object that exposes IDispatch? Lots of older MSDN pages mention IDispatch without any COM context. Does it have a separate history, and was just introduced under the COM 'umbrella' later in its lifecycle? Where does OLE fit in? Is its (considerable) presence in MFC naming and MSDN in general - all just legacy? Wikipedia gives some insight, but not much. I couldn't find a