com

How do I go about instantiating a COM Object in C# by CLSID?

别等时光非礼了梦想. 提交于 2019-12-06 08:13:16
问题 Forgive me if my terminology is off, as this is somewhat uncharted territory for me. I have a program which needs to create a FolderShortcut . Microsoft has documentation on how to create it in C++, and I'm trying to translate the directions to C#. The instructions state that the CoCreateInstance function needs to be called with CLSID_FolderShortcut as a parameter, which I infer to mean that it's instantiating a COM object. The CLSID for this object is {0AFACED1-E828-11D1-9187-B532F1E9575D} .

How do I read the formatted textual representation of a cell in Excel

情到浓时终转凉″ 提交于 2019-12-06 08:12:52
问题 I'm using the COM interface to Excel and I would like to get hold of the formatted textual representation of a cell rather than the true underlying value. For example, suppose the cell contains the number 1.23456 and the user has specified the number format with 1 decimal place. Then I'd like to be able to read the string "1.2" . I know that I can use Range.Text but this fails in a couple of significant ways. Range.Text returns what the user sees in the view of the sheet and so if the cell is

CoCreateInstance does not start or connect to ATL COM service

岁酱吖の 提交于 2019-12-06 08:11:32
问题 I have a ATL COM service exe (MyService.exe), which compiles and runs fine. If I install this service (via MyService.exe /Service), it is successfully installed into the SCM. I can start the service through the SCM and it runs fine, under the LOCALSYSTEM account. My problem arises when I attempt to create an instance of a COM class defined by the service. My test harness application (MyServiceTest.exe), calls the following: ::CoInitialize(NULL); ::CoInitializeSecurity(NULL, NULL, NULL, NULL,

Convert VARIANT to…?

北城以北 提交于 2019-12-06 07:45:05
Note: Attempting to invoke a method of an interface, of which the return type is _variant_t Code: _variant_t resultsDataString; _bstr_t simObjectNames; simObjectNames = SysAllocString (L"TEST example 3"); resultsDataString = pis8->GetSimObject (simObjectNames); inline function illustrated below, contained in .tli FILE: inline _variant_t IS8Simulation::GetSimObject ( _bstr_t Name ) { VARIANT _result; VariantInit(&_result); HRESULT _hr = get_SimObject(Name, &_result); if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); return _variant_t(_result, false); } Note: resultsDataString is

C# Marshalling COM objects between threads

≯℡__Kan透↙ 提交于 2019-12-06 07:42:26
问题 I'm getting very confused about whether C# marshal's COM objects between threads. To this end I have an application which is loading a set of files in a task parallel fashion. I'm using the StaTaskScehduler to load the files using the COM object. Once the COM object is loaded I am storing the object in a central list. I then later try to perform some processing on this data, again using the STATaskScheduler. However at this point I hit a problem. I receive an exception as follows: An

Lotus Notes Automation: Notes.NotesSession doesn't implement Domino::ISession?

ⅰ亾dé卋堺 提交于 2019-12-06 07:38:49
I'm trying to improve my Lotus Notes client code: Working: #import "...\IBM\Lotus\Notes\notes32.tlb" no_dual_interfaces raw_native_types CComPtr<IDispatch> session_dispatch; if(FAILED(session_dispatch.CoCreateInstance(_T("Notes.NotesSession")))) ... NOTESSESSION *session = static_cast<NOTESSESSION *>(*&session_dispatch); This gives me a valid NOTESSESSION object that is aware that it needs to go through IDispatch to actually invoke methods. I found some example code on the net, which looks a lot saner and assumes a later Notes version: #import "...\IBM\Lotus\Notes\domobj.tlb" raw_interfaces

Exactly what are these _B_var_Xxxxx and _B_str_Xxxxx members in the VBA COM libraries?

只谈情不闲聊 提交于 2019-12-06 07:24:22
Imagine the following function call: foo = UCase("bar") I'm parsing this code, and determine that UCase is a function call; now I want to resolve that function call to the declaration of the function in the COM library it's defined in. The idea is to implement a code inspection that determines when a Variant built-in function is used when a String -returning function exists, like here UCase$ could be used instead. It seems the functions I'm after are declared as _B_var_Ucase and _B_str_UCase in the COM library; I'm picking up a UCase member in the VBA.Strings module, but it's returning VT_VOID

Is there a working example of COM event handling in C++ Builder?

依然范特西╮ 提交于 2019-12-06 07:16:57
I am trying to connect a C++ Builder app with a .NET service app, and would like the .NET service app to be able to send events back to the C++ Builder app. Is there a working example of a C++ Builder app which can handle COM events? There was an error in the DocWiki regarding handling COM Events. I was able to collect some examples from various places, and put them together here for reference. The .NET application has the following: using System; using System.IO; using System.Runtime.InteropServices; namespace IPractLib01 { // // GUID's to use for the COM objects. [Guid("ACD03FE3-E506-4D87

How to detect programmatically when the OS has done loading all of its applications\services?

自古美人都是妖i 提交于 2019-12-06 07:06:30
问题 Edit : I rephrased my question, please ignore all of the comments below (up to the 7th of May). First off, I'll try to explain the problem: My process is trying to show a Deskband programmatically using ITrayDeskBand::ShowDeskBand. It works great at any time except for when the OS is loading all of its processes (after reset or logout). After Windows boots and starts loading the various applications\services, the mouse cursor is set to wait for a couple of seconds (depends on how many

Compiling VB6 app w/ .NET interop, only runs if compiled on my machine

烈酒焚心 提交于 2019-12-06 06:45:37
问题 I recently developed an interop user control in .NET (Visual Studio 2008, project targetting .NET 2.0) to be used in a VB6 application. The assembly exposes 1 control, 1 class, and a few enums and structs. I developed it using C# translations of the Interop Forms Toolkit 2.0 project template found here. The assembly has a strong name and gets installed in the GAC and registered with regasm with the following script: @"C:\gacutil.exe" /i "C:\Program Files\AppName\Control.dll" /f @"C:\WINDOWS