com

pass adoconnection from vba to delphi

筅森魡賤 提交于 2020-01-02 04:54:07
问题 I'm looking to create a COM object in a VBA macro and then pass it to a Delphi DLL (D2009). What should my procedure declaration in Delphi look like? Background: I'm expecting (hoping) the VBA macro to: create the COM object, invoke the Delphi DLL, pass the COM object to the Delphi DLL procedure, stay alive until the Delphi DLL closes itself (the DLL will have embedded forms for the user to interact with). I think I'll need to create a callback function to let the VBA macro know that I'm done

calling .NET COM object from VBScript

别等时光非礼了梦想. 提交于 2020-01-02 03:27:27
问题 I use VS 2008 and Windows 7. Got a .NET C# class which is exposed as COM object. [Guid("E5014B85-FCB2-4F0D-95EC-F741395A7923")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DSystem { [DispId(1610809354)] void setProperties(IDictionary propertymap); } COM object is called from a VBScript dim dSystem set dSystem = CreateObject("MYCOMOBJECT") Dim objDictionary Set objDictionary = CreateObject("System.Collections.Hashtable") objDictionary.Add "PROP1", "abc" objDictionary.Add

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

岁酱吖の 提交于 2020-01-02 03:17:26
问题 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

Problem with hanging interop COM objects

﹥>﹥吖頭↗ 提交于 2020-01-02 03:13:45
问题 I have an application that uses COM interop to create a spreadsheet which is opened in Excel on the client's machine. It appears, however, that the EXCEL.exe process isn't always ended when Excel is closed by the user if I look at Task Manager. If I was saving the workbook and programmatically closing Excel, I would just use Marshal.ReleaseComObject() to clean up, but since I'm depending on a manual close of the program, I'm not sure what to do. Any suggestions? 回答1: Excel cannot terminate

ATL COM class registration .rgs file defaults

旧巷老猫 提交于 2020-01-02 03:11:07
问题 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

ATL COM class registration .rgs file defaults

落花浮王杯 提交于 2020-01-02 03:11:01
问题 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

How to use COM dll in my C++ program

走远了吗. 提交于 2020-01-02 02:55:09
问题 I wish to use a COM dll in my C++ library. The way I figured going about it, is to #import the dll's .tlb file, which I did : #import "mycom.tlb" no_namespace The problem is , I don't quite know where to place this declaration. should it be inside the H file or the CPP file? or maybe the stdafx.h file? I tried placing it in the .cpp file , just for testing. in the H file I have this member declared : ILogicSecuredPtr m_pbLogic; (where ILogicSecured is the interface I want to work with in my

AccessViolationException from WebBrowser control with custom IDownloadManager

妖精的绣舞 提交于 2020-01-01 19:16:51
问题 My .NET application hosts a WebBrowser control, and I've attached a custom download manager. Everything seems to work fine except for requests with the following two HTTP headers: Content-Type: application/octet-stream Content-Disposition: attachment; filename=blahblahblah Change or omit the content type header, and everything works fine; it's just application/octet-stream that has the problem. Remove the content disposition header and the download manager isn't used. Interestingly, this

C++ and DirectShow

白昼怎懂夜的黑 提交于 2020-01-01 17:06:30
问题 I'm just getting started with DirectShow programming, and the 'C' nature of the DirectShow API is making my skin crawl. Endless return codes instead of exceptions, addref/release all over the place, functions taking pointer to pointers... Are there any 'C++ friendly' wrappers for DirectShow programming that hide all the COM ugliness underneath.? 回答1: For 98% of DirectShow code, you should never see a call to AddRef or Release. Always use CComPtr<>. There are a few minor exceptions to this

System.Windows.Forms.Timer not firing

白昼怎懂夜的黑 提交于 2020-01-01 17:00:34
问题 I want to use a System.Windows.Forms.Timer to ensure that an event fires on the UI thread of an excel addin I'm creating. I construct the timer as follows: private System.Windows.Forms.Timer _timer; private void ThisAddIn_Startup(object sender, System.EventArgs e) { Debug.WriteLine("ThisAddIn_Startup:" + Thread.CurrentThread.ManagedThreadId); _timer = new System.Windows.Forms.Timer(); _timer.Tick += new EventHandler(TimerEventHandler); _timer.Interval = 500; } The timer is fired by a COM