com

Cannot pass arguments to ActiveX COM object using PyQt4

久未见 提交于 2019-12-02 10:20:02
I'm trying to write some Python code to talk to the Thorlabs APT ActiveX control. I'm basing my code on the code found on this page , but trying to use PyQt4 ActiveX container instead of the wxPython ActiveX container. It works for a very simple ActiveX methods, however, I get an error when trying to call a method that takes arguments. This code works and shows the about box for Thorlabs APT: import sys from ctypes import * from PyQt4 import QtGui from PyQt4 import QAxContainer class APTSystem(QAxContainer.QAxWidget): def __init__(self, parent): self.parent = parent super(APTSystem, self)._

DEBUG ERROR : Runtime needed for <name.exe> occurs while cusing COM in vc++ project?

不羁的心 提交于 2019-12-02 10:00:33
I have created a COM component for my work. I have registered the component also. On my system I have two VM workstations. In my first workstation it works fine. In my second workstation it displays an error box containing the message this program needs a rumtime and closes an unusual way please contact applications administrator . I thought that this was because of not registering the dll in the second worksation then I registered and it works fine. When i tried to test the same in win2k8 machine even though I register the COM component successfully it shows the above said erroe window?? Can

Multithreaded C++ application using Matlab Engine

◇◆丶佛笑我妖孽 提交于 2019-12-02 09:57:16
I open Matlab engine in an initialization thread, doing : bool MY_MATLAB_ENGINE_o::Open() { // Handle the case where engine is already open if( MatlabEngine ) { return true; } else if( !( MatlabEngine = engOpen( 0 ) ) ) { return false; } IsEngineOpen.SetValue( true ); return true; } Function engOpen() opens a COM channel to Matlab. Once the engine is open, the thread falls in wait event mode. Then, in another thread, I do this : bool MY_MATLAB_ENGINE_o::ChangeDirectory( QString strPath ) { QString strPathToScript = "cd('" + strPath + "');"; QByteArray ba = strPathToScript.toLatin1(); const

Register C# COM Object without having a real file for RegAsm

假如想象 提交于 2019-12-02 09:46:18
I have a wierd application loading mechanism. I have a boostrapping exe file with all the other DLLs and the application itself inside it's resources. These files (assemblies) are extracted from resources and loaded ond emand because i'm attaching to the Assemblyresolve event of the current AppDomain. [STAThread] static void Main() { // if the command line contains extract then extract the dlls, next run will resolve assemblies from disk bool saveDllsToDisk = new List<string>(Environment.GetCommandLineArgs()).Contains("extract"); // if the command line contains bin then use the bin folder

How to return List from c# and use it in vc++ through com

拥有回忆 提交于 2019-12-02 09:25:53
How to return List from c# method and Use the List return values in c++ can u give guidance how to do it?? I going like following way my complete scenario: in c# DemoLib.cs usng System;using System.Collections.Generic; public interface IDiscover { void GetList1(); String GetList2(); List<string> GetList3(); }; namespace DemoLibrary { class DemoLib { public void GetList1() { Console.WriteLine(" I am from Void GetList()"); } public string GetList2() { Console.WriteLine(" I am from string GetList()"); return "Stack OverFlow"; } public List<string> GetList3() { List<string> li=new List<string>();

WindowInteropHelper.Handle — do I need to release it?

非 Y 不嫁゛ 提交于 2019-12-02 08:54:13
In WPF I'm getting IntPtr handle using this code: IntPtr mainWindowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle When I finish using this handle, do I need to release it in anyway (e.g. using Marshal.FreeHGlobal() method) ? EDIT: I was thinking about Marshal.FreeHGlobal(), not Marshal.Release(), sorry! This is not in any way related to COM, Marshal.Release() does not apply. You simply get a copy of the native window handle, it does not have to be released. You need to stop using the handle when the window is destroyed. Signaled by the Window.Close event. 来源: https:/

Wrapping a COM object/dynamic type in C#

爷,独闯天下 提交于 2019-12-02 08:14:15
问题 I am currently working with COM objects in managed code and am using the new dynamic type for this. This works well in some areas but can be an issue in others. I was think about how I could get the best of both worlds, the flexibility of the dynamic type (late bound) with the support for say, an RCW (early bound) Somehow wrapping the dynamic type in a more manageable stucture. I was wondering if there was a preferred method for this (if it is even a good idea) or what things I should

Why does this code throw System.AccessViolationException when called from a C# project targeting Any CPU?

时光毁灭记忆、已成空白 提交于 2019-12-02 08:11:49
I have this IDL in my ATL project: [ object, uuid(61B0BFF7-E9DF-4D7E-AFE6-49CC67245257), dual, nonextensible, pointer_default(unique) ] interface ICrappyCOMService : IDispatch { typedef [ uuid(C65F8DE6-EDEF-479C-BD3B-17EC3F9E4A3E), version(1.0) ] struct CrapStructure { INT ErrorCode; BSTR ErrorMessage; } CrapStructure; [id(1)] HRESULT TestCrap([in] INT errorCode, [in] BSTR errorMessage, [in, out] CrapStructure *crapStructure); }; [ uuid(763B8CA0-16DD-48C8-BB31-3ECD9B9DE441), version(1.0), ] library CrappyCOMLib { importlib("stdole2.tlb"); [ uuid(F7375DA4-2C1E-400D-88F3-FF816BB21177) ] coclass

ASP.NET and STA COM objects

て烟熏妆下的殇ゞ 提交于 2019-12-02 08:04:45
问题 Looking to settle an argument here. All the stuff I've read on using a COM object created in VB from an ASP.NET page is surrounding with WARNING - MAKE SURE YOU PUT ON ASPCOMPAT OR IT WON'T WORK http://books.google.co.uk/books?id=-sjg09Crh40C&lpg=PA771&ots=g-vqDun9TR&dq=asp.net%20c%23%20sta&pg=PA771#v=onepage&q=&f=false However... I have set this up and guess what - no problems. Now, I read this http://msdn.microsoft.com/en-us/library/zwk9h2kb.aspx and http://blogs.claritycon.com/blogs/don

get word document count and number of slides count in PPT

那年仲夏 提交于 2019-12-02 07:54:51
Is it possible to get the number of pages in word document or number of slides in a ppt. I have done a lot of research on it and i am desperately looking for solution. I saw that it is very difficult to get it done in PHP on linux server. I would be ok with Java also, but is it possible. I checked the apache POI library, but would it work for both PPT, PPTX, doc and docx. I am rigorously searching for some solution but i am unable to get one. Any help would be really really appreciated. To get meta data properties of doc,docx,ppt and pptx like number of pages, number of slides **USING PHP** i