com

In Windows, is there any way to convert an errno into an HRESULT?

浪子不回头ぞ 提交于 2019-12-05 07:14:29
I know the HRESULT_FROM_WIN32 macro to convert a Win32 error code into an HRESULT, is there any way to do the conversion starting from an errno error? In short, no. As of http://msdn.microsoft.com/en-us/library/5814770t%28v=vs.100%29.aspx The errno values are constants assigned to errno in the event of various error conditions. ERRNO.H contains the definitions of the errno values. However, not all the definitions given in ERRNO.H are used in 32-bit Windows operating systems. Some of the values in ERRNO.H are present to maintain compatibility with the UNIX family of operating systems. The errno

HOWTO: Call Managed C# Interface From Unmanaged C++ On WindowsCE Compact Framework

假如想象 提交于 2019-12-05 06:37:56
I have extensive unmanaged Windows CE 5 C++ code that provides a UI that I want to use in a new product by combining it with a large amount of newer business and communications logic written in managed C# on Windows CE 6 and the Compact Framework. The UI may know about the business logic, but I want the business logic ignorant of the UI such that I can later replace it with a managed version, or any other UI that I choose as a front-end. I found an article that describes how to use COM as the bridge in the Windows world, but I'm having difficulty applying it in the .NET CF under WinCE. In the

Making Property Handler for my application to add custom properties to a file format

我的未来我决定 提交于 2019-12-05 06:20:02
问题 I wanted to add custom properties for my application file type, just like Microsoft Word file tyep .docx has properties on Details Pane in vista and window 7 that show author property and e.t.c trying to do the same for my application but have no clue yet. working in .net2.0 .i dont know what i am doing wrong, using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime

How to find out a COM prog id?

微笑、不失礼 提交于 2019-12-05 06:07:31
I'd like to access a COM library via late binding. How can I find out its progID? Type oClassType = Type.GetTypeFromProgID("THE MISSING PROGID"); cmsjr The progID is generally going to be of the form Library.Class, you can view what classes a COM library exposes using oleview. The feature you want in oleview is View TypeLib (three little red triangles). The Library name will be at the top and you will want to use the name of the class as seen under CoClasses 来源: https://stackoverflow.com/questions/1272061/how-to-find-out-a-com-prog-id

C# Outlook 2007 COM interop application does not exit!

怎甘沉沦 提交于 2019-12-05 06:03:38
Any ideas why the following code does not exit the Outlook 2007 process created via COM interop? Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); var item = app.Session.OpenSharedItem("C:\\test.msg") as Microsoft.Office.Interop.Outlook.MailItem; string body = item.HTMLBody; int att = item.Attachments.Count; (item as Microsoft.Office.Interop.Outlook._MailItem).Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard); System.Runtime.InteropServices.Marshal.ReleaseComObject(item); (app as Microsoft.Office.Interop.Outlook._Application

C# - writing a COM server - Properties mapped to methods

随声附和 提交于 2019-12-05 05:56:09
问题 We are trying to replace a COM server originally written for a VB6 application We have no access to source code. For some reason, the VB6 app can call our constructor, but then it gets: System Error &H80004002. No such interface supported. I assume when it tries to get the interface with QueryInterface. We have our assembly properly sent through regasm /tlb and gacutil, but I then noticed something strange. I opened the .tlb file regasm generated for our assembly, and noticed all the

What are the alignment limitations of the standard global default operator new?

こ雲淡風輕ζ 提交于 2019-12-05 05:54:07
I'm working on some older code that uses ATL's CComBSTR type. I'm changing it so that it will compile using Visual C++ Express Edition, which does not come with ATL. I used only a very small subset of CComBSTR , so doing this is fairly simple. However, when allocating the BSTR memory block, I need to fill the first four bytes with a 4 byte length prefix. I'm concerned that if I use a new char[size] expression to allocate the memory for the string, that I will cause alignment faults due to the allocated char array not having the correct alignment for the four byte prefix. Is there anything in

How to use COM dll in my C++ program

℡╲_俬逩灬. 提交于 2019-12-05 05:48:18
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 COM dll) Then I added this in the constructor to instantiate the interface : CoInitialize(NULL); m

Problem with hanging interop COM objects

二次信任 提交于 2019-12-05 05:43:03
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? Excel cannot terminate until all its out-of-process objects are released. So it just hides its user interface and keeps running.

calling .NET COM object from VBScript

て烟熏妆下的殇ゞ 提交于 2019-12-05 05:38:41
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 "PROP2", "zyx" dSystem.setProperties(objDictionary) Everything works fine ... but, a return type