.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DCOM Interop: Generate Custom Managed C++ Wrappers for Easier COM Interoperation Using DCOMSuds

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Now that you're writing managed code, you'll certainly want to use your existing COM components, but you can't simply call them directly. Instead, you have to wrap the COM component in a runtime-callable wrapper that acts as a proxy between the component and your managed code. While the CLR provides wrapper classes for this purpose, there will be times when you'll want custom objects to wrap your COM components. One way to get the low-level access you need to precisely control resource cleanup, pass security information, and get access to CLR features is to write your own wrapper class in managed C++. This article shows you how.

Vishwas Lele

MSDN Magazine August 2003

View Complete Post

More Related Resource Links

UI on the Fly: Use the .NET Framework to Generate and Execute Custom Controls at Run Time


Creating UI controls on the fly can be accomplished via run-time code generation. And there are lots of reasons to do so. Generating these controls once and then reusing them as needed is more efficient than generating the controls each time. Read on.

Morgan Skinner

MSDN Magazine December 2005

Stay Alert: Use Managed Code To Generate A Secure Audit Trail


In today's security-conscious environments, a reliable audit trail is a valuable forensic tool The Windows Server 2003 operating system provides features that let you enable a wide range of applications to make use of auditing functionality. This article looks at auditing from the operating system perspective and describes a sample managed code implementation that will allow you to add auditing to your own server applications.

Mark Novak

MSDN Magazine October 2005

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application


Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004

.NET Remoting: Create a Custom Marshaling Implementation Using .NET Remoting and COM Interop


The .NET Framework offers several methods for customizing the presentation of native .NET and COM object types. One such technique, custom marshaling, refers to the notion of specializing object type presentations. There are times, like when a legacy COM component needs to implement a new interface or when you need to make calls across process or machine boundaries, when custom marshaling saves the day. Elements of COM Interop permit the customizing of COM types while .NET Remoting offers the developer the ability to tailor native .NET types. This article examines these techniques.

Jim Sievert

MSDN Magazine September 2003

.NET Interop: Get Ready for Microsoft .NET by Using Wrappers to Interact with COM-based Applications


Very soon, the development of Microsoft .NET applications will require interaction between those apps and existing COM components on both the client and the server. The .NET Framework has made provisions for this interaction by implementing various wrappers for COM objects to allow exposure of their properties and methods to .NET components. These wrappers will make it easy to make the connection between COM and .NET. After discussing wrappers, this article discusses other ways for .NET components to take part in COM+ transactions. To top off the tutorial on the interoperation of COM and .NET, the article discusses how ActiveX containers can host .NET controls, and how .NET containers can host ActiveX controls.

David S. Platt

MSDN Magazine August 2001

Microsoft .NET: Implement a Custom Common Language Runtime Host for Your Managed App


While most application developers may not need to write a custom host, understanding what is involved provides a great deal of insight into the architecture of the CLR. After covering how the CLR is started and loaded into a process, how to set the available configuration options, and how a host defines application domains, this article explains how to design a custom host. Important concepts include making the right decisions about the application domain boundaries for the host, configuring them correctly, loading and executing user code, and resolving references to assemblies. Setting security policy and unloading application domains as the application shuts down are also explained.

Steven Pratschner

MSDN Magazine March 2001

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"

Managed Accounts - Generate New Password causes "The password does not meet the password policy requ

Hello, We are setting up our SharePoint 2010 Farm. I liked the idea of the managed accounts with auto-generating passwords managed by SharePoint. So I setup all my accounts as managed accounts and scheduled several of them to update the password weekly. After the "update" happened my farm went down. So I manually reset passwords and went back into Central Admin to see what was going on. From the managed accounts I tried to manually update the password of my Farm account with the Generate new password functionality and get this error. Error The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements Servers are in a domain with a one-way trust to a parent domain. Thanks!

Warning1:There are updated custom wrappers available for the following referenced components: Micros

Hi, I have a form application that it calls Excel form in it. The form works with no problem in XP (32bit OS). I have one 64bit machine that Windows7 is installed on it. When I run the same project in this one, using Visual C#, it issues a warning like: Warning 1 There are updated custom wrappers available for the following referenced components: Microsoft.Office.Core ,Microsoft.Office.Interop.Excel ,VBIDE.  It builds the code fine (ofcourse with the above warning) but it crashes during compilation time. There is no other warning or error. Just simply won't compile. The Office installed is Pro 2007 and is installed fully on this machine the same as the XP machine. It would be appreciate if someone could help me figure out what can be wrong and how I can fix it. Thank you very much. Red      

list of employees - custom list or managed metadata term set ?

Hi all, I am working on a intranet site for a small company with 25 employees. They want to create a site for tracking employee training. Most of the items on this site are going to be associated with an employee entity. What is the best way to manage the employee entity ? should I create a custom list called employee or should I create a term set called employee containing the names of all 25 employees ? In a related question is it possible to add a "people picker" field to a custom list ? ( e.g. Training schedule list ) I note that for 'assign to' columns SharePoint provides a dialog which enables you to browse and select users from active directory. Is there a way to add similar lookup functionality to a custom list in SharePoint ? thanks and regards, Counie  

Display Managed Metadata with Custom Search

Hello everyone, I made a custom Search page in VS 2010 and exported it to Sharepoint Foundation with Search Server. I want to use it to search for custom folders i have created which have a metadata field, a descriptive text. I have created a managed property and mapped it to the metadata of the folder content type. Also, the metadata shows up in the library view. Now, when i want the Metadata to show up in the results page of my search, i get "Field of property with name mappedfieldname wasnt found in the selected data source" error. when i pick a field like title instead, it works. but with a vast number of other fields i get the same error, like filename or filetype. i tried this on three servers, one of them with sharepoint server on it, everytime getting the same error. i did crawls everytime, i created the managed property, mapped it, i dont know what the problem is. help would be greatly appreciated.   Edit: i use datagrid to display the results,         i can also use the managed property in the search query; like filename:"1.txt", but i cant display the very same property in the result grid.

Custom interop

Hi I have a requirement where my application throws an event, which I want third party applications be able to access... Which I assume is what "interop" means. I've seen the Interop Forms Toolkit... but that looks like something for VB6. Which approaches can I take to do this? So far, I only have sockets in mind (i.e. my app creates a socket server, all other third party apps connect to that socket, and listen for data written on it). But isn't there something "else"? Purpose-made? I've seen/read COM alot... but apparantly that's old, and not very user friendly.  

Sorting search results by custom managed property


I am customizing the XSLT for the core results webpart to give the user the option to sort search results by a certain managed property. There are several managed properties that I am listing on the search results page, and when the user clicks one, it should sort the results by that property.

In MOSS 2007, you could use the "v=property" parameter in the URL to define the sort order, but this doesn't seem to work anymore in SharePoint 2010. Are there any ideas on how to accomplish this?

Communication between x64 COM and managed DCOM server

Hi all,

I have 64bit COM object written in C++ and 64bit (not Any CPU) managed DCOM server. When I try to pass a reference of my COM object to the managed DCOM server I get an error. After debugging I found that the wrapper in .tli returns 0x80004002 (E_NOINTERFACE). When I compile both COM object and the managed DCOM server for x86 everything works fine. I saw that tlbimp.exe tool has /machine option but when I try to use it for my 64bit binary I get the following error:

TlbImp : error TI0000 : A single valid machine type compatible with the input type library must be specified

Currently I using tlbimp.exe against 32bit binary and then copy/paste the source code shown in .NET Reflector. As far as I can see the code is not platform specific and as I said when I compile both projects for x86 everything works fine. Still it seems there is something wrong with x64 marshalling.

Thanks in advance

Issue using Managed Metadata with custom fields in the User Profiles application


Hi there,

I've created several custom properties in my User Profile Application.

I've also created several Term Sets in the Managed Metadata service application Term Store for use with these custom properties. Some of the Term Sets contain terms and have a closed submission policy whilst others have an open submission policy.

If the user hasn't already populated any of these custom fields in their profile, when they click on the Edit My Profile link from their My Site Profile page everything seems okay (for the first time).

The user is then able to successfully select values for these custom fields - the metadata is available. They can click on the "tag" icon to select values, or start typing and the suggestions appear. They are also able to enter new values into custom property fields where the term set is open to submission.

If they then Save and Close then go back into Edit My Profile, often not all of the existing data is populated in the metadata custom fields. On different occasions different fields may be blank. Sometimes this is accompanied by the error "Message from webpage / The server method 'ValidateTerms' failed", but not always.

Has anyone else tried this or have any suggestions are to what the issue might be?

Thanks in advance.

How to add custom properties to terms in the SharePoint 2010 managed metadata term store?


There is a "Term.CustomProperties" collection to get the collection of custom property objects for the current Term object from the read-only dictionary.
But where and how to define and set custom properies for terms? This dictionary seems to be read-only by default.

Any help / documentation would be appreciated. / Frank

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend