com

How to get Outlook 2003 accounts list using Outlook 2003 object model

廉价感情. 提交于 2019-12-12 04:09:06
问题 Is it possible to get list of all existing accounts from Outlook 2003 using only standard COM? It means I can't use Redemption library, but only default Outlook 2003 object model . It's much easy to get accounts at Outlook 2007/2010: dynamic outlook = AutomationFactory.GetObject("Outlook.Application"); var accounts = outlook.Session.Accounts; But there is no "Accounts" property for Outlook 2003. By default I can access only default account using "CurrentUser" property. So maybe is there some

Set WMP volume level

孤者浪人 提交于 2019-12-12 03:59:18
问题 What i want to do is set the Windows Media Player's volume level. By default the volume is in-/decreased by 10% when e.g. clicking the down or up menu item (Play -> Volume -> Up), but this is, in my opinion, not fine enough (especially when e.g. skypeing with someone while listening to music). The media player should stay an independent application. Currently i'm using a little tool that sends app commands via SendMessage to the player with parameters as seen in spy++. I thought of three ways

Calling my COM method from C# results in a null structure returned if HRESULT is not 0

房东的猫 提交于 2019-12-12 03:54:57
问题 Here is my C# code: static void Main(string[] args) { CrappyCOMService service = new CrappyCOMService(); CrapStructure crapStructure = new CrapStructure(); try { service.TestCrap(1337, "This is bananas.", out crapStructure); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } Console.WriteLine(crapStructure.ErrorCode); Console.WriteLine(crapStructure.ErrorMessage); } Here is my IDL: [ object, uuid(61B0BFF7-E9DF-4D7E-AFE6-49CC67245257), dual, nonextensible, pointer

Interface Marshalling in Delphi

こ雲淡風輕ζ 提交于 2019-12-12 03:45:13
问题 I want to send Interface Ref of IVApplication from Visio Add-in to my other one COM server. But I have Ole exception. Now i do that: Code in Visio Add-in: var IStrm: IStream; hres: HResult; rhglobal: HGLOBAL; VisioAppl: IVApplication; begin hres := CreateStreamOnHGlobal(0, TRUE, IStrm); if Succeeded(hres) then hres := CoMarshalInterface(IStrm, IID_IVApplication, VisioAppl, MSHCTX_LOCAL, 0, MSHLFLAGS_NORMAL); if (Succeeded(hres)) then begin hres := GetHGlobalFromStream(IStrm, rhglobal); if

How to have an async connection to COM with a WPF interface?

半世苍凉 提交于 2019-12-12 03:26:33
问题 My previous question (SelectedIndex is unchanging in tabcontrol - Dispatcher issue) didn't get very far, and I suspect I was on the wrong track to begin with. There are 3 givens in my program: I have a main window which is WPF. I connect to a separate application (a different process) which implements a COM server which can be called on at various times to perform time-consuming calculations, the results of which I will display in my window. I do not want the main window to freeze while

C# IFileOperation How to get status and error information for all operations

扶醉桌前 提交于 2019-12-12 03:19:44
问题 I would like to use IFileOperation in my .NET C# application. I found this article http://blogs.msdn.com/b/msdnmagazine/archive/2007/12/12/6738569.aspx (source code is available here http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/NetMatters2007_12.exe). It is working well so far but I want to get status and error information for all operations. There is line of code: if (_callbackSink != null) _sinkCookie = _fileOperation.Advise(_callbackSink); which should

How can I dynamically instantiate an ActiveX control from an .ocx file?

自作多情 提交于 2019-12-12 03:19:22
问题 I would like to create an instance of an ActiveX control. Given the .ocx file and interface definitions in C#, how can I do this? I don't mean the usual way of adding a reference to the project because I want to avoid the need for registering the control globally on the target system. 回答1: This looks like you should check into Registration-free COM. Beware that this does not work on older systems IIRC. For some details/samples etc. see: http://msdn.microsoft.com/en-us/library/fh1h056h.aspx

Why does TypeName() return different results from .GetType and TypeOf when working with COM?

强颜欢笑 提交于 2019-12-12 03:19:07
问题 I feel like I would benefit greatly from understanding the differences in how these functions work so that I could better understand when to use each one. I'm having a very difficult time working with two different interops (Excel, and EPDM) which have both made extensive use of weak typed parameters. I keep running into problems using returned objects and casting them to the proper type (per the documentation). After wasting a ton of time, I've found that using TypeName, GetType, and a

0x80010100: System call failed" exception, ContextSwitchDeadlock

亡梦爱人 提交于 2019-12-12 03:15:02
问题 Long story short: in a C# application that works with COM inproc-server (dll), I encounter "0x80010100: System call failed" exception, and in debug mode also ContextSwitchDeadlock exception. Now more in details: 1) C# app initializes STA, creates a COM object (registered as "Apartment"); then in subscribes to its connection-point, and begins working with the object. 2) At some stage the COM object generates a lot of events, passing as an argument a very big collection of COM objects, which

CreateObject on Outlook.Application fails on Outlook 2010 when Outlook is running under a different account

微笑、不失礼 提交于 2019-12-12 03:07:54
问题 The problem I'm running into is already described at Getting/Creating an Outlook Application in Windows 7 but I had a very hard time identifying the source of the problem because I happen to be maintaining an old VB6 application at the moment, and the errors that are reported from VB6 applications are not mentioned in that article. Furthermore, I'm looking for better solutions. The problem is that CreateObject("Outlook.Application") and GetObject(,"Outlook.Application") are failing with Error