Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting COM servers for the windows API in C#, where to begin?
    text
    copied!<p>I am trying to write some plugins to work with the <a href="http://msdn.microsoft.com/en-us/library/cc644955%28v=vs.85%29.aspx" rel="nofollow noreferrer">Terminal Services Session Broker Plugin Interface</a>. I am very fluent in C# but I have not done any C++ since the late 90's. For the plugin I am writing I plan on communicating with a database and I would prefer to use <code>System.Data.SqlClient</code> to talk to it as I know it's ins and outs fairly well. I have the <a href="http://www.microsoft.com/download/en/details.aspx?id=8279" rel="nofollow noreferrer">Windows SDK</a> which has provided my with the .idl file for the interface (<code>tssbx.idl</code>). The SDK also provides a C header file (<code>tssbx.h</code>) and a C source file (<code>tssbx_i.c</code>).</p> <p>I have never written a COM server before, and I have been having a lot of trouble finding resources on learning how to read a IDL file and turn it in to C#. Everything I find says "<a href="https://stackoverflow.com/questions/1307675/convert-interface-idl-file-to-c-sharp">Use TlbImport</a>" but that requires things like the block <code>library</code> to be in the IDL which <code>tssbx.idl</code> does not (nor its dependents) implement.</p> <p>What would be my best option:</p> <ol> <li>Find a tool for C# that is the equivalent to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa367300%28v=vs.85%29.aspx" rel="nofollow noreferrer">MIDL</a> for parsing a .idl file in to a .cs file.</li> <li>Learn IDL (I have been having trouble finding good guides to learn it) and write the whole thing in C# by hand.</li> <li>Write a helper dll using the C files provided and have that call in to my C# dll for my .NET parts.</li> <li>Re-learn C++, use the provided .h and .c files, and use the CLR to make my .NET calls.</li> <li>Some other option I have not thought of.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload