ole-automation

.NET DateTime, different resolution when converting to and from OADate?

拜拜、爱过 提交于 2019-12-28 17:57:05
问题 I'm converting a DateTime to OADate. I was expecting to get the exact same DateTime when converting the OADate back, but now it has only millisecond resolution, and is therefore different. var a = DateTime.UtcNow; double oadate = a.ToOADate(); var b = DateTime.FromOADate(oadate); int compare = DateTime.Compare(a, b); //Compare is not 0; the date times are not the same Ticks from a: 634202170964319073 Ticks from b: 634202170964310000 The OADate double: 40437.290467951389 What is the reason for

Is it possible to automate a Click-to-run application?

只谈情不闲聊 提交于 2019-12-23 07:55:38
问题 I have a small application which automates Microsoft Word via COM/OLE Automation. Unfortunately this doesn't work with the virtualized Click-to-run editions of Word, because they don't have the required keys in the registry. (At least not where they are exptected to be) In other words: CreateObject fails because the necessary COM classes are not registered. Is there any way to automate the Click-to-run editions of Microsoft Office? Perhaps some compatibility layer? EDIT: I found just two

Register a proxy/stub in HKEY_CURRENT_USER

醉酒当歌 提交于 2019-12-22 11:47:50
问题 The MIDL compiler generates code for a proxy/stub with registration routines that write to HKEY_LOCAL_MACHINE. Is there any way (preferably without hacking the MIDL-generated code and without bypassing all that generated code in favor of custom code) to register a MIDL-generated p/s in HKEY_CURRENT_USER? Also: Will this work if both the p/s and the COM server are registered per-user like this? I just found (after a very frustrating 48 hours) that a p/s registered machine-wide will not work

From C#, open an arbitrary application

不羁岁月 提交于 2019-12-22 08:39:09
问题 Related question [stackoverflow] here. I'm trying to do the above, but I want to take the process one step further. I want to open an arbitrary file using the default editor for the file type. From that point, I want to allow my user to interact with the file as they would normally, or continue to work in my application. The extension is what happens after the user finishes editing. Is there a way I can capture a close (and ideally save) event from the external application and use that as a

How to convert Java Date to OADate or vice versa?

假如想象 提交于 2019-12-19 11:56:31
问题 I want to convert Java Date to Microsoft OLE Automation - OADate type or want to convert OADate to Java Date. What is the formula of the OADate for Java? Actually I have searched in the stackoverflow and couldnt find the answer, I got the answer and want to share it in this community. For Example: 43013.7659837963 equals to Thu Oct 05 18:23:01 EET 2017 回答1: Microsoft's OLE Automation Date Converter for Java How to convert Java Date to OADate: /** * Convert Date to Microsoft OLE Automation -

Making an async COM call — do I have to create my own P/S?

╄→尐↘猪︶ㄣ 提交于 2019-12-16 18:04:52
问题 I have a custom interface defined in a type library and implemented in my code. I have not created my own proxy/stub. I have successfully marshaled the interface pointer from my main thread (STA) to a background thread (STA), in my case using IGlobalInterfaceTable. From that background thread, I want to make an asynchronous call to the object on the UI thread. I have not implemented ICallFactory in my object. I see that the standard proxy does indeed implement ICallFactory (i.e, I can

How to pass a parameter to a OLE Automation object such as MS Word

坚强是说给别人听的谎言 提交于 2019-12-12 11:24:42
问题 This is mainly a Delphi syntax related question. I need to set a parameter to True when calling a method of an OLE object. I need to set in Word Automation (this is from Word Reference): wdApp.Quit SaveChanges:=wdDoNotSaveChanges As an example a dummy procedure where I would like to do this follows (please note WordApp.Quit!): Procedure GetWordVersion; var WordApp: OLEVariant; begin { Create the OLE Object } Try WordApp := CreateOLEObject('Word.Application'); WordVersion := WordApp.version;

IAdviseSink setup for catching MSWord document events

本秂侑毒 提交于 2019-12-12 10:57:51
问题 Here is the code where I try to setup IAdviseSink interface implemented in my TForm1 class for catching some events of the newly created MSWord document. I have not any errors while the code runs, but I can't catch any event, while save the document or close it. How-to setup IAdviseSink for MSWord document correctly? var Form1 : TForm1; doc_ole_obj : IOleObject; word : IDispatch; Connection: LongInt; implementation //------------ Setup IAdviseSink procedure TForm1.Setup; begin word :=

Document.Save is Showing SaveAs Dialog

佐手、 提交于 2019-12-11 20:35:13
问题 I have a Visual Studio 2010 VB.NET 4.0 Windows Application project. The code is populating a Word 2010 document. There are anywhere in the region of 30 to 60 tables and anywhere in the region of 30 to 50 embedded charts (all defined as inline shapes ( InlineShape )). I had to start putting in regular Document.Save() calls as I was getting the following error: There are too many edits in the document. This operation will be incomplete. Save your work. . There is plenty of disk space available

Using a indentifier or reserved word in a automation object under FPC

大兔子大兔子 提交于 2019-12-10 19:51:28
问题 Actually i am using OLE automation under Free Pascal , but some objects have properties which uses reserverd words as names, so i cannot compile the code. check this sample MyObj : OleVariant; begin MyObj := CrealeOleObject('AObject'); MyObj.Descriptor := Param1; MyObj.Type := Param2; //this line generates a error this is the error StdOleAux.pas(783,15) Fatal: Syntax error, "identifier" expected but "TYPE" found so the question is how i can access this properties in FPC when they have a name