com

Coinitialize(nil) and CoInitializeEx(0, COINIT_MULTITHREADED) difference

夙愿已清 提交于 2019-12-05 02:05:59
in a thread, is there a difference if I use Coinitialize(nil) instead of CoInitializeEx(0, COINIT_MULTITHREADED); I use Delphi 7 but I presume the question can remain for other programming languages Thanks for your help. David Heffernan The former initializes COM in a way that puts the calling thread into its own single-threaded apartment (STA). The latter initializes COM in a way that puts the calling thread into a shared multi-threaded apartment (MTA). The two apartments have very different semantics, especially in how COM objects are accessed across thread boundaries. Threads in different

python使用win32com的心得

大城市里の小女人 提交于 2019-12-05 01:59:05
p ython可以使用一个第三方库叫做win32com达到操作com的目的, 我是安装了ActivePython的第三方库,从官网下载了安装包,该第三方库几乎封装了所有python下面的win32相关的操作,例如win32api,win32gui等等,可以说是比较齐全的了,下载地址可以自行百度获取。 主要是有个项目可能要用到ppt转换成视频的功能。 之后在想使用com操作excel还有word,ppt的时候,相信大部分人跟我一样,都是搜索python如何操作ppt,或者win32com操作office之类的搜索语句, 搜索完毕之后,点进去之后,几乎都直接是代码了,我觉得这样看得我云里雾里的,如果想做些其它操作都做不到,我当时的想法是想知道这些com的操作,究竟在哪里可以查找的到,因为网上只是有限的几个操作,注入往ppt添加图片,或者doc转成pdf之类的,而实际上的office的com操作时不止这些函数的,那么我们怎么知道其它的api呢?这样子我们就可以脱离网上的代码,自己编写com代码了。 一番查找,谷歌之后,在一个网页上终于找到了答案: Querying Interfaces Now, how does one investigate the detail of each object? For example, how does one access the name of

How to wait on WaitHandle without message pumping?

谁说胖子不能爱 提交于 2019-12-05 01:53:55
I want to call WaitHandle.WaitOne(TimeSpan) in .NET, but I'm on the STA thread and it pumps messages while waiting. For reasons that are beyond the scope of this question, I need to wait without pumping. How can I wait for a WaitHandle to be signaled without pumping messages? It seems in some scenarios that WaitHandle.WaitOne does not pump messages. But it does sometimes for some messages. See these links for more information on that: Managed and Unmanaged Threading in Microsoft Windows Managed blocking WaitForSingleObject or WaitForMultipleObjects are non-pumping waits; use p/invoke.

How to do a simple mail merge in OpenOffice

混江龙づ霸主 提交于 2019-12-05 01:52:07
问题 I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net or C# via OLE or native API. Are there any good examples available? 回答1: I haven't come up with a solution I'm really happy with but here are some notes: Q. What is the OO API for mail merge? A. http://api.openoffice.org/docs/common/ref/com/sun/star/text/MailMerge.html Q. What support groups? A. http://user.services.openoffice.org/en/forum/viewforum.php?f=20 Q. Sample code? A. http://user.services.openoffice.org/en

How To Programmatically Enable/Disable 'Display PDF In Browser' For Acrobat / Reader XI or DC For Use With Adobe ActiveX Control

江枫思渺然 提交于 2019-12-05 01:45:22
We have a .NET C# application that makes use of the Adobe ActiveX Controls. For versions 7-10 of both Adobe Acrobat and Adobe Reader, to use this control you were required to turn on the "Display PDF In Browser" setting. You could do this manually from the GUI using Preferences > Internet > Display PDFs in browser or programmatically by setting the registry settings directly HKEY_CURRENT_USER\Software\Adobe\(Product Name)\(Version)\Originals "bBrowserIntegration"=dword:00000001 Which follows the SDK reference http://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/Originals.html

Is it possible to expose a C# Enum to COM Interop callers, and if so, how?

拥有回忆 提交于 2019-12-05 01:21:12
I have a managed assembly that gets called via COM Interop. Like a VBScript client, a Perl client, and so on. The classes are decorated with [ClassInterface(ClassInterfaceType.AutoDual)] [GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000E")] [ComVisible(true)] Then of course I do the regasm thing, and all the methods work just fine. But there are also enum types in the assembly. I'd like to use symbolic names COM applications, for the enum values. How do I expose the enums via COM interop? Do I just need to add these attributes? [GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000E")]

What is XPCOM? XPCOM vs COM?

喜欢而已 提交于 2019-12-05 01:10:15
问题 I have trouble understanding XPCOM. How is it different from COM? What makes it cross platform? Is it a framework with a set of libraries that you can use to do some jobs? Also, does Component Object Model means every functionality is implemented in component so we can use it without knowing the detail implementation? Can you someone help me understand this please? Thanks, Chan. 回答1: I have trouble understanding XPCOM. How is it different from COM? XPCOM is Mozilla's own, cross-platform

How can I return both an error string and error code to VB6 from an ATL activex control?

倖福魔咒の 提交于 2019-12-05 01:05:51
问题 I'm trying to return a detailed error to VB6 using CComCoClass::Error, but it seems I can only return an error code /or/ a message - but not both. return Error(_T("Not connected"), __uuidof(IMyInterface), HRESULT_FROM_WIN32(ERROR_CONNECTION_INVALID)); results in a generic "Method 'Request' of object 'IMyInterface' failed" error message in Err.Description on the VB6 side (but ERROR_CONNECTION_INVALID in Err.Number), while return Error(_T("Not connected")); results in the appropriate error

Wrong exception after calling .net4.0 com server from delphi application

隐身守侯 提交于 2019-12-05 01:03:19
问题 We are migrating our codebase from BDS2006 to Rad Studio XE, and we found some very strange behavior: if we make invalid floating point operation (ie. division by zero) after creating some object from COM server implemented in .Net4.0, we don't get normal exception (ie. EDivisionByZero), but EStackOverflow. We managed to prepare very simple example: ComErrorExample There is an .net 4.0 assembly, with com interface (one function returning string) and simple delphi application: var a, b: Double

What is F# equivalent of C# “public event ”

旧城冷巷雨未停 提交于 2019-12-05 00:52:56
问题 I'm trying to translate to F# code from this article http://www.codeproject.com/Articles/35532/C-COM-Object-for-Use-In-JavaScript-HTML-Including I've stumbled on this lines: public delegate void MyFirstEventHandler(string args); public event MyFirstEventHandler MyFirstEvent; I've tried to translate this in F# as: type MyFirstEventHandler = delegate of string -> unit type MyFsComComponent () = let my_event = new Event<MyFirstEventHandler,string> () [<CLIEvent>] member x.MyFirstEvent = my_event