com

ATL COM class registration .rgs file defaults

主宰稳场 提交于 2019-12-05 05:29:11
I'm creating a COM server executable, and have run into a problem with class registration. When I created my class object, the automatically generated .rgs file looked like this: HKCR { NoRemove CLSID { ForceRemove {4C6DAD45-64B4-4C55-81C6-4CE125226421} = s 'Test Class' { ForceRemove Programmable LocalServer32 = s '%MODULE%' { val ServerExecutable = s '%MODULE_RAW%' } TypeLib = s '{EAA173CA-BDBC-463A-8B7A-B010EFA467BC}' Version = s '1.0' } } } This created the registry entries correctly for the CLSID. However, when attempting to call CoCreateInstance externally, I was experiencing a hang. hr =

Passing a C# class instance back to managed code from JavaScript via COM

对着背影说爱祢 提交于 2019-12-05 05:09:07
The basic outline of my problem is shown in the code below. I'm hosting a WebBrowser control in a form and providing an ObjectForScripting with two methods: GiveMeAGizmo and GiveMeAGizmoUser . Both methods return the respective class instances: [ComVisible] public class Gizmo { public string name { get; set; } } [ComVisible] public class GizmoUser { public void doSomethingWith(object oGizmo) { Gizmo g = (Gizmo) oGizmo; System.Diagnostics.Debug.WriteLine(g.name); } } In JavaScript, I create an instance of both classes, but I need to pass the first instance to a method on the second instance.

OneNote 2013 Add-in won't load. How to debug?

风格不统一 提交于 2019-12-05 04:56:46
问题 I'm following the excellent tutorial by Malte Ahrens on how to create a OneNote add-in. Initially I followed it step by step, making a few changes (just renaming the class, and using my own name and GUID in the assembly) info. As I'm using VS2012 and am not yet ready to hand-roll a WiX installer I manually copied over the built dll to the correct place and also created a registry file to make the requisite entries. I confirmed that they were all there, loaded up OneNote but no add-in, going

How to use CoCreateInstance() to get a com object?

这一生的挚爱 提交于 2019-12-05 04:30:50
I had registered a COM component.And I want to call it. CLSID clsid; RIID iid; HRESULT hr = CLSIDFromProgID(OLESTR("se.mysoft"),&clsid); LPVOID *pRet; HRESULT hr1 = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, pRet); I can get the clsid successful, but where can I get the iid ? I used OLE VIEWER find interface: [ odl, uuid(F3F54BC2-D6D1-4A85-B943-16287ECEA64C), helpstring("Isesoft Interface"), dual, oleautomation ] interface Isesoft : IDispatch { Then I changed my code: CLSID clsid; RIID iid; IDispatch* pDispatch; HRESULT hr = CLSIDFromProgID(OLESTR("se.mysoft"),&clsid); HRESULT

How does .NET/COM work with multiple versions registered via Regasm?

◇◆丶佛笑我妖孽 提交于 2019-12-05 04:29:55
I have a .NET DLL (that happens to be written in C++/CLI). Parts of it I want to expose via COM. I do this and register it using "regasm my.dll /codebase". So far so good. But then I change some things and the version number of the assembly changes plus I move the dll to a different folder. I register it again and look at my COM object in OLE/COM Viewer. I see something like this InprocServer32 [Codebase] = file://c://foo/bar/my.dll 7.0.0.0 [Class] = My.Blah.Class 7.0.0.0 [Assembly] = Sync, Version=7.0.0.0, Culture=neutral, PublicKeyToken=1dd19234234 7.0.0.0 [RuntimeVersion] = v2.0.50727 7.0.0

Why is the C# CreateObject so much more verbose than VB.NET?

妖精的绣舞 提交于 2019-12-05 04:08:50
I am looking to convert some VB6/COM+ code to C#/COM+ However where in VB6 or VB.NET I have: Dim objAdmin objAdmin = Server.CreateObject("AppAdmin.GUI") objAdmin.ShowPortal() In C# it seems like I have to do the following: object objAdmin = null; System.Type objAdminType = System.Type.GetTypeFromProgID("AppAdmin.GUI"); m_objAdmin = System.Activator.CreateInstance(objAdminType); objAdminType.InvokeMember("ShowPortal", System.Reflection.BindingFlags.InvokeMethod, null, objAdmin, null); Is there a way of getting c# to not have to use the InvokeMember function and just call the function directly?

Python: Access embedded OLE from Office/Excel document without clipboard

我怕爱的太早我们不能终老 提交于 2019-12-05 03:00:41
I want to add and extract files from an Office/Excel document using Python. So far adding things is easy but for extracting I haven't found a clean solution. To make clear what I've got and what not I've written the small example test.py below and explain further. test.py import win32com.client as win32 import os from tkinter import messagebox import win32clipboard # (0) Setup dir_path = os.path.dirname(os.path.realpath(__file__)) print(dir_path) excel = win32.gencache.EnsureDispatch('Excel.Application') wb = excel.Workbooks.Open(dir_path + "\\" + "test_excel.xlsx") ws = wb.Worksheets.Item(1)

How do I replace all occurrences of string in Word documents in a folder

情到浓时终转凉″ 提交于 2019-12-05 02:48:40
问题 I've managed to find& edit per one word file. With this code: $objWord = New-Object -comobject Word.Application $objWord.Visible = $false $objDoc = $objWord.Documents.Open("C:\users\stefan\test\New Microsoft Word Document.docx") $objSelection = $objWord.Selection $FindText = "that" $MatchCase = $False $MatchWholeWord = $true $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $wdFindContinue $Format = $False $wdReplaceNone = 0 $ReplaceWith =

Run VBScript on server from javascript/php

独自空忆成欢 提交于 2019-12-05 02:47:04
问题 I have a Single Page Application written in JavaScript and PHP, I am trying to run an external .vbs file on my server? I have tried using the php COM class as well as exec() to no avail. Has anyone successfully achieved this? Is it even possible? 回答1: Found this gem: http://technet.microsoft.com/en-us/library/ee156587.aspx By that, you should try the similar in PHP: exec('wscript "C:/path/to/script.vbs"'); 来源: https://stackoverflow.com/questions/18410163/run-vbscript-on-server-from-javascript

将LINUX的控制台定向到串口终端

早过忘川 提交于 2019-12-05 02:34:06
将LINUX的控制台定向到串口终端(转载) 利用串口终端作为Linux控制台,可以免去额外的键盘,显示卡和显示器,同时可将Linux主机作为一个任意用途的嵌入式黑匣。将串口终端连接到 计算机 的串口上并不困难,可以参考Linux的HOWTO文档和以及inittab和agetty的帮助信息。这里扼要地说一下。   首先,准备好一根null modem 电缆.   其次,在 文件 /etc/inittab 增加下面一行。[注:如果你不采用 agetty 程序 ,采用其他的程序如like getty_ps ,应用正确的 命令 语法]    ID:RUNLEVELS:respawn:/sbin/agetty -L SPEED TTY TERM   这里: ID =两字母的标识符,如s1或s2。   RUNLEVELS = 终端激活的运行级别   SPEED = 串口端口速率   TTY = 串口的设备名   TERM = TERM 环境 变量   范例如下:   s2:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100   表示串口 /dev/ttyS1 (COM2 )速率为 9600 bps,终端模式为vt100。   最后,重新启动机器。   如正确地按照上述三步进行,则就可以在终端屏幕上出现Login: 的提示符。你可以登录进 系统