com

Accessing resources in registered .NET DLL via res protocol

落花浮王杯 提交于 2019-12-11 23:25:08
问题 I have a .NET DLL that I register with regasm.exe as a Browser Helper Object. I embedded several Win32 resources in the DLL using .res files and /win32 switch to csc.exe. image.png HTML "image.png" I am able to access the resources using the res protocol as long as I include the absolute path of the DLL . res://C:\Path\To\My\Dll\Assembly.dll/image.png This is rather unfortunate. I would much rather just reference the assembly name as I have seen in many other examples: res://Assembly.dll

Not able to copy specific pages of word document

非 Y 不嫁゛ 提交于 2019-12-11 23:19:20
问题 I am trying to cut specific pages of my word document(.docx), say 2, 4. I am using for loop to traverse as per the page gave splitting it based on , .Below is the code for the same if (startEnd.Contains(',')) { arrSpecificPage = startEnd.Split(','); for (int i = 0; i < arrSpecificPage.Length; i++) { range.Start = doc.GoTo(WdGoToItem.wdGoToPage, WdGoToDirection.wdGoToAbsolute, arrSpecificPage[i]).Start; range.End = doc.GoTo(WdGoToItem.wdGoToPage, WdGoToDirection.wdGoToAbsolute, arrSpecificPage

Copy Excel Chart Sheet to clipboard using C#

落爺英雄遲暮 提交于 2019-12-11 23:17:36
问题 I am writing a C# app. One of the tasks is to open an Excel spreadsheet and paste a chart sheet from it into the the C# app. Please note I am referring to a CHART SHEET...not a chart object embedded on an ordinary Worksheet. There is a reason why I am trying to be precise here. I use ordinary COM to communicate from C# to Excel... using using Microsoft.Office.Interop.Excel; In a situation where a chart is embedded in an ordinary worksheet, the API works. I retrieve the worksheets from

Windows 7, VS2010, .NET and AxMSCommLib

孤人 提交于 2019-12-11 23:16:03
问题 I have a project that is referencing the AxMSCommLib in VS2010 C#.. My Windows 7 Dev machine doesn't have or can't find this reference. Does anyone have any info on where to get this reference to make it work? 回答1: MSCommLib is an ancient VB6 control. I don't have it either anymore, even though I installed the VB6 runtime support on this machine. You'd have to dig up an old VB6 installer somewhere, no idea where to look. Maybe you can get it from an old machine, copy mscomm32.ocx into your c:

How can I force a client to call an explicitly specialized template instead of the primary template?

不想你离开。 提交于 2019-12-11 20:37:52
问题 This is pseudocode for what I want to do. template<typename T> struct ConvertToT { static_assert(false, "Explicit specialization for T required."); // Variant will be coerced to this type before calling Convert. std::uint32_t GetVariantType() { return VT_EMPTY; } T Convert(CComVariant& input) { return "ERROR!"; } }; template<> struct ConvertToT<std::wstring> { std::uint32_t GetVariantType() { return VT_BSTR; } T Convert(CComVariant& input) { return std::wstring(input.bstrVal, ::SysStringLen

DllGetClassObject return “No such interface supported” while CoCreateInstance can find it successful

别等时光非礼了梦想. 提交于 2019-12-11 20:07:11
问题 I want to use the library "sqlceoledb35.dll" to process .sdf db file without register. I know this dll is a COM dll and used in ADO. But I can't get the target interface, it returns error "No such interface supported". Here is the code: CoInitialize(nullptr); HMODULE hmod = CoLoadLibrary((L"sqlceoledb35.dll"), true); DllGetClassObject_t pDllGetClassObject =(DllGetClassObject_t)GetProcAddress(hmod, "DllGetClassObject"); HRESULT hr=NOERROR; IDBInitialize *pIDBInitialize1=NULL; IDBInitialize

How do I make a TypeConverter known to an assembly that is called from a COM library?

纵然是瞬间 提交于 2019-12-11 19:21:34
问题 I have a c# project that consists of a COM typelib (ComLib), a C# tools classlibrary (ComTools) and a main C# project (ComMaster)that is used as a testbed for the COM typelib. See the code at the bottom. When calling the COM object from the ComMaster (not as a com object, but as a 'normal' C# object), everything works fine: The call from ComLib to ComTools works and ComTools finds the TypeConverter located in ComLib. The DoIt function pops up a nice Messagebox saying: Original: Hello

including classes with a wsc file

◇◆丶佛笑我妖孽 提交于 2019-12-11 19:19:58
问题 Ok, what am i doing wrong here? i'm trying to include a vbscript with a class inside this way: SCRIPT.VBS: set inc = createobject("script.runner") inc.Include "class" set x = new test x.msg' here i get the error 'undefined class'! REGISTERED .wsc file: <?xml version="1.0"?> <component> <registration description="wsc" progid="script.runner" version="1.00" classid="{f65e154c-43b3-4f8f-aa3d-535af68f51d1}" > </registration> <public> <method name="Include"> <PARAMETER name="Script"/> </method> <

Access: persist a COM reference across Program Reset?

情到浓时终转凉″ 提交于 2019-12-11 19:19:27
问题 Are there ways in Access VBA (2003) to cast a COM reference to an integer, and to call AddRef/Release? (which give the error "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic") I'm using a third-party COM object which doesn't handle being instantiated twice in a single process (this is a known bug). I therefore thought of storing the reference as the caption of a control on a hidden form to protect it from Program Reset clearing

How to access COM vtable and acess its entries from TLB(Type Library) in C#?

允我心安 提交于 2019-12-11 18:34:16
问题 I need to access COM vtable which have entries of those functions which are exposed to outside world under some specific interface in C#. I've accessed and iterate over the types enclosed in the TLB with LoadTypeLib and playing with ITypeInfo . Now only thing I need to access one by one those methods inside vtable of COM Interface and need to call them at RUNTIME one by one. I need COM vtable address and its indexed entries (i.e function addresses). 回答1: You can create a C# wrapper from the