com

Get my application to be allowed access through firewall using c#

孤街浪徒 提交于 2019-12-02 13:26:45
问题 i am trying to get my application to be allowed through firewall, as I have to do ftp in active and passive mode is not an option as servers are not configured for that. so i tried the below code which compiles fine, I exexcute it using: MyApp.Classes.INetFwMgr mgr = new MyApp.Classes.INetFwMgr(); mgr.AuthorizeApplication(Application.ProductName, Application.StartupPath, NET_FW_SCOPE_.NET_FW_SCOPE_ALL, NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY); And the class which does the job: private const

COM Interop fails when moving to new server

核能气质少年 提交于 2019-12-02 13:15:26
问题 I've run into a problem I just can't seem to solve. The background: Years ago, I developed a web site for one of my customers using ASP 2.0 and Ajax. One function of the web site is to produce customer invoices, on demand. Their in-house production system is written in Visual Foxpro 8 with SQL Server 2005 on the back end. Since I already had an invoice generation object that would produce a PDF file, I rolled up a COM EXE and created a COM wrapper for use in my ASP page. It works great for

Fatal Error: “Class not registered” creating COM Object

时间秒杀一切 提交于 2019-12-02 12:50:53
I have an app that makes use of third party software using PHP(32 bit PHP) COM object, everything is working fine on my local machine (Windows 7, 64bit). When I deployed my app to a live server (Windows Server 2012, 64bit) and I try to create my COM object I'm getting the Fatal Error: Cannot create object "Class not registered" After finding these other SO questions: Class not registered error from PHP Failed to create COM object 'X': Class not registered in another WAMP I have ran regsvr32.exe (the 32bit version) for my DLL with message prompt indicating successful registry. And also verified

Pass byte array within struct to a com object

浪子不回头ぞ 提交于 2019-12-02 12:43:28
I wrote a C++ COM server (out-of-proc) and client so: idl (interface is IDispatch ): typedef[uuid(0952A366-20CC-4342-B590-2D8920D61613)] struct MyStruct{ LONG id; BYTE* data; } MyStruct; [helpstring("")] HRESULT foo([out] MyStruct* pStreamInfo); server: STDMETHODIMP foo(MyStruct* myStruct) { myStruct.id = 7; myStruct.data = pData; // pData is a pointer to some data of variable length return S_OK; } client: MyStruct ms; hr = comObj->foo(&ms); The code will work fine except when adding the myStruct.data = pData; line which crashes the server. Assigning memory in the client e.g. ms.data = new

Registration-free Interop between a 64-bit COM dll and a C#/.Net application

我们两清 提交于 2019-12-02 12:36:25
问题 I am trying to get registration-free COM interop between a 64-bit COM dll and a C# app to work. In the answers to a previous question of mine, I got help that allowed me to successfully call a HelloWorld method on the 64-bit COM dll for C#. However, this was only possible by registering the COM dll globally using regsrv32.exe. Based on this answer to a related question, I think that I need to set the Isolated flag on the reference of the COM dll to true. However, this leads to the following

Use SHAssocEnumHandlers in C#

只谈情不闲聊 提交于 2019-12-02 12:13:17
问题 I am struggling to call the WinAPI SHAssocEnumHandlers in C#. using System; using System.Runtime.InteropServices; namespace AssocHandlerTest { [Flags] public enum ASSOC_FILTER { ASSOC_FILTER_NONE = 0x0, ASSOC_FILTER_RECOMMENDED = 0x1 }; [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("F04061AC-1659-4a3f-A954-775AA57FC083")] public interface IAssocHandler { int GetName([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppsz); int GetUIName([Out, MarshalAs(UnmanagedType

C# class attributes not accessible in Javascript

早过忘川 提交于 2019-12-02 12:05:18
I want to make a class of mine accessible in JavaScript via a C# WebView-Control. Therefore I am using the WebView.AddWebAllowedObject method. However if I assign an attribute, it works fine, but if I assign the whole class to get all attributes in js, all of the attributes(and methods btw) are "undefined". I tried everything I found in the www. See the attached code: //The class I want to make accessible [AllowForWeb, ComVisible(true)] [MarshalingBehavior(MarshalingType.Agile)] public class DeviceInformation { public string IPAdress { get; private set; } public DeviceInformation() { IPAdress

How can I programmatically control the Microphone and Microphone Boost settings in Win7 from C#?

这一生的挚爱 提交于 2019-12-02 11:43:43
Windows 7 has some new audio settings which I haven't been able to control from my C# application. Specifically, within the Input (microphone) properties, there is a Levels Tab containing Microphone and Microphone Boost sliders, and a Microphone mute toggle / checkbox. I need to programatically ensure that the Microphone is not muted--but have not found the necessary APIs to either read or set the values. I was unable to find an API that provided control over these specific volume levels. Please add new answers if they are available and I'll gladly accept a working solution. You can use a very

Converting a vb.net dictionary to a vba dictionary

浪尽此生 提交于 2019-12-02 11:37:28
问题 I was pleased to find that I could call structs that I had set up in vb.net straight into excel vba - using COM visible and registering using regasm.exe. I am struggling to do the same with a dictionary created in vb.net. I found this link which suggested that the dictionary in vb.net was not the same as the runtime.scripting dictionary found in vba. I was unable to have much luck with the links suggested in the comments though. Here is the vb.net code: Public Function ReturnDict() As

MyGroups not implemented in Communicator.UIAutomation

隐身守侯 提交于 2019-12-02 10:34:14
I'm working on a out of browser Silverlight app that provides some MS Office Communicator 2007 controls. I'm using the Automation SDK . The docs that were installed with the SDK state that there's a MyGroups property in the IMessenger2 interface, which will return the groups that a user has defined, but when I try to use it, I get a NotImplementedException . Here's the code that I'm using: dynamic communicator = AutomationFactory.CreateObject("Communicator.UIAutomation"); communicator.AutoSignin(); foreach (dynamic g in communicator.MyGroups) { //Do something with the group } If I replace