com

Get PID of COM server

末鹿安然 提交于 2019-12-25 00:22:34
问题 I create a com object in powershell like so: $application = new-object -ComObject "word.application" Is there a way to get the PID (or some other unique identifier) of the launched MS Word instance? I want to check if the program is blocked e.g. by modal dialogs asking for passwords, and I can't do it from whithin PowerShell. 回答1: Ok, I found out how to do it, we need to call the Windows API. The trick is to get the HWND, which is exposed in Excel and Powerpoint, but not in Word. The only way

UWP sideload app that use Microsoft.Office.Interop.Outlook COM

こ雲淡風輕ζ 提交于 2019-12-24 23:52:34
问题 Hello Im updating a UWP app that we use in ouroffice. Before when we use it to send email it uses the Windows.ApplicationModel.Email.EmailMessage however this i really limited. So i would like to use Microsoft.Office.Interop.Outlook instead to create the email directly with outlook My test code looks like this. try { List<string> lstAllRecipients = new List<string>(); //Below is hardcoded - can be replaced with db data lstAllRecipients.Add("info@test.com"); //lstAllRecipients.Add("chandan

how do you enumerate WIN32OLE available servers?

删除回忆录丶 提交于 2019-12-24 22:16:11
问题 Wasn't able to find an easy answer to this one... Anyway I've seen some WIN32OLE code like this: WIN32OLE.new("MSVidCtl.MSVidWebDVD.1") Which works. My question is, how is it possible (in any programming language) to have figured that string out? Like enumerating all the available servers or what not? My google fu failed me here. Thanks. -r More resources (some of which answer my question, I believe--not sure why I didn't see these before) How to list all ActiveX controls? axhelper looks nice

C#: DLL is registered but COM error 80040154 still appear

女生的网名这么多〃 提交于 2019-12-24 19:23:53
问题 When I debug my Windows Form Application I get this error: Retrieving the COM class factory for component with CLSID {27526253-6119-4B38-A1F9-2DC877E72334} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) and because of it, my WFA can't interface with the software Solidworks installed on my computer; the only library that WFA needs to interface with Solidworks is SolidWorks.Interop.sldworks.dll (native position in the

Function pointer as a parameter of COM method

笑着哭i 提交于 2019-12-24 19:08:42
问题 I have created COM server in C++ that is used from C# application. Now I have to add one more method to my COM object and one of its parameter must be function pointer to callback function. C++ original function looks like this: typedef int (__stdcall *tCallBackFunc)(int Param); void MyFunc(void* CallBackFunc) { int Param; //some code ((tCallBackFunc)(CallBackFunc))(Param); //call callback function } I need to add MyFunc as COM object method. VS VC++ "Add Method" dialog offers some predefined

Excel 2007 automation on top of a Windows Server 2008 x64 - NON SYSTEM USER

匆匆过客 提交于 2019-12-24 19:02:17
问题 Folks, I have the exact same issue that's presented here, except that I'm trying automate Excel using a non-system (user) account. The solution of creating a desktop folder doesn't work, because the user already has a desktop folder. I can get the solution to work for the System Account just fine. I can also get it to work for the Administrator account, when logged-in. Is this in fact a Session 0/1 issue or is that still a red herring? 回答1: Chase this down with SysInternals' ProcMon, probably

Marshalling a VARIANT back from COM to C++ client

谁说胖子不能爱 提交于 2019-12-24 18:59:18
问题 I'm attempting to marshal a safearray of BSTRs from a COM object, back to a C++ client application. My IDL definition of the function involved: [id(5), helpstring("method GetStreams")] HRESULT GetStreams( [out,retval] VARIANT* pvarStreamNames ); Here's my implementation of the GetStreams() function: STDMETHODIMP CArchiveManager::GetStreams(VARIANT* pvarStreamNames) { CComSafeArray<BSTR, VT_BSTR> saStreamNames; CComVariant varOutNames; Stream* pNext = NULL; int nNumStreams = m_Streams

STA or MTA for indirectly used COM Objects

孤街浪徒 提交于 2019-12-24 18:15:20
问题 I think I understand the apartment concept and why STA or MTA is used, however a question came up for which I found no solution so far. If my application uses COM Objects under the hood, for example from third party libraries, how do I know if I can use MultiThreaded-Appartment (MTA)? In that case, I have no Idea if those objects are thread safe, so do I need to go with STA, just to be on the safe side? 回答1: Your ability to use certain COM interface pointer on STA or MTA thread code depends

Saving file as PDF by using Microsoft.Office.Interop.Excel

寵の児 提交于 2019-12-24 15:45:50
问题 I'm using the Microsoft.Office.Interop.Excel.Workbooks.Open() method for opening an .XML file and then using the Microsoft.Office.Interop.Excel.Workbook.ExportAsFixedFormat() method for publishing (saving) the opened .XML file as a .PDF file. Now on my Development and Preproduction environments everything is working well, but on our Production server it's seems that when the call for Microsoft.Office.Interop.Excel.Workbooks.Open() is made the method execution is then sopped or even not

VBA COM interop troubles

无人久伴 提交于 2019-12-24 15:14:44
问题 I have some sample code from MSDN that I am trying to adapt for use but the VBA compiler rejects the contents of the angled brackets < > . I have the following code in a module: Imports System Imports System.Runtime.InteropServices <DllImport("../../insert_dll_name_here.dll", CallingConvention:=CallingConvention.Cdecl)> _ Public Function Test(file() As String) As Integer End Function I am trying to use this code to call a simple function from a C++ dll that expects an array of strings but I