com

Which VC++ runtime version do I choose - static or dynamic?

家住魔仙堡 提交于 2020-01-04 05:05:00
问题 I'm developing a 64-bit in-proc VC++ ATL COM server that basically just redirects all calls to an out-proc COM server. So my COM server basically does nothing. Initially it used the C++ runtime in a DLL ( /MD compiler switch). I've noticed that when I deploy it on a clean 64-bit Win2k3 regsvr32 fails with an error: LoadLibrary({fileName}) failed – This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Google

debugging an inproc com server running in dllhost.exe

这一生的挚爱 提交于 2020-01-04 04:53:13
问题 I am writing an inproc com dll that runs in the dllhost.exe surrogate, but I am running into an issue debugging it. if there were multiple dllhost.exe's running at once, it would be annoying to find the right one to attach a debugger to. Is there an easy way to identify yours if a lot are running? Thanks 回答1: Process explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653) has convenient feature that allows you to look at which processes have loaded which DLLs. You can also do a

c++ How to get a COM object Coclass's progid at runtime

本小妞迷上赌 提交于 2020-01-04 04:40:13
问题 I need to write a function that dynamically extracts the progid from a COM object. Is this possible? What's the best way to do it? EDIT: All the coclasses I need to process implement IProvideClassInfo 回答1: First of all, there is no guarantee the information is available in first place. Even if you just instantiated an object using ProgID, you might be unale to get it back. The easiest is to query one of IPersist and friends ( IPersistStream etc.) interfaces, and call IPersist::GetClassID to

Making COM calls from single thread hangs the thread

霸气de小男生 提交于 2020-01-04 02:44:08
问题 I have an application that does some excel automation through an automation add in. This add-in is multithreaded, and all the threads manage to make calls to the excel COM objects. Because excel can sometimes return a "is busy" exception when making multiple calls, i have wrapped all my calls in a "retry" function. However i feel this is inneficient. I am now trying to make all the calls to excel objects on the same thread, so that all calls are "serialized" by me, therefore reducing the risk

return array of object from C# to C in COM

谁说胖子不能爱 提交于 2020-01-04 02:39:10
问题 I am using COM to communicate between C++ and C#. I have the following classes in C# Email Address /// <summary> /// Email Address /// </summary> public class EmailAddress { /// <summary> /// SMTP Address /// </summary> [MarshalAs(UnmanagedType.BStr)] public string Address; /// <summary> /// Name /// </summary> [MarshalAs(UnmanagedType.BStr)] public string Name; } Mailbox /// <summary> /// MailBox Entity /// </summary> public struct MailBoxEntity { /// <summary> /// SMTP Address /// </summary

Ref param returning array of unknown size. How to handle?

偶尔善良 提交于 2020-01-04 02:34:10
问题 A COM component exposes an API which expects a ref param of object type. As per the documentation of this API, it will fill the ref object with array of values. Now my problem is in prod env I can't predict the number of elements which I will get back. Following code will work. COMClass objCOM = new COMClass (); object colOfInts= new int[10]; // What if I don't know the following will return array of size 10? int errorcode = objCOM.FillThisIn(ref colOfInts); But what if I don't know the size

Outlook COMException

北战南征 提交于 2020-01-03 17:37:05
问题 System.Runtime.InteropServices.COMException ..Your server administrator has limited the number of items you can open simultaneously... at Microsoft.Office.Interop.Outlook._AppointmentItem.get_UserProperties() var calendar = outlookApplication.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar); if (calendar == null || calendar.Items == null) { return null; } var calendarItems = calendar.Items; if (calendarItems != null && calendarItems.Count > 0) { // Dont convert to LINQ

Outlook COMException

主宰稳场 提交于 2020-01-03 17:36:25
问题 System.Runtime.InteropServices.COMException ..Your server administrator has limited the number of items you can open simultaneously... at Microsoft.Office.Interop.Outlook._AppointmentItem.get_UserProperties() var calendar = outlookApplication.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar); if (calendar == null || calendar.Items == null) { return null; } var calendarItems = calendar.Items; if (calendarItems != null && calendarItems.Count > 0) { // Dont convert to LINQ

How to convert C# code that uses Shell COM to F#?

蹲街弑〆低调 提交于 2020-01-03 13:56:11
问题 I have the following C# method: private static bool IsLink(string shortcutFilename) { var pathOnly = Path.GetDirectoryName(shortcutFilename); var filenameOnly = Path.GetFileName(shortcutFilename); var shell = new Shell32.Shell(); var folder = shell.NameSpace(pathOnly); var folderItem = folder.ParseName(filenameOnly); return folderItem != null && folderItem.IsLink; } I have tried converting this to F# as: let private isLink filename = let pathOnly = Path.GetDirectoryName(filename) let

Classic ASP and COM DLL Does not work in Server 2008 R2 (Microsoft VBScript runtime error '800a01ad' ActiveX component can't create object )

久未见 提交于 2020-01-03 13:31:56
问题 I have created a dll in Visual Studios 2010. I have performed the following steps: Given build a strong name by associating a key pair (snk file) to it Given each class an individual ProgID and GUID As it is a 64 bit DLL I made sure that Used the RegAsm.exe located in the 'FrameWork64/v4xxxx' folder. I used RegAsm.exe /codebase ECE2.dll I ran 'gacutil -i' on the DLL All of these steps have been successful. The DLL and the ASP page I am using it on are stored in intetpub/wwwroot. Now, the DLL