Friday, April 8, 2011

COM to .NET

How to make a .NET class library be accessible as a COM object?
  1. Create a new .net class library project for the wrapper
  2. Declare the class as "ComVisible":
    using System.Runtime.InteropServices;
    [ComVisible( true )] public class ClassName
  3. Generate the Keyfile:
    C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\sn.exe -k "keyfile.snk"
  4. Set the project property to sign the library using the generated keyfile
  5. Generate the Registry entry with the path to the library .dll as the "codebase":
    regasm.exe %TRGDIR%\LibName.dll /codebase
    Specify also the /tlb option if the library is to be imported by the C++ #import directive
  6. Check the registry has the ProgId: LibName.ClassName and refers to the CLSID which has the "codebase" path to the LibName.dll

Friday, April 1, 2011

min-height in IE

All the standard browsers have the min-height CSS property, but IE has it only in the strict !DOCTYPE mode (which is a nightmare) and it does not work properly anyway.
As a workaround, we can do the following
1) Specify the min-height which is ignored by IE
2) Specify the "hight" for IE only.
How to make the other browsers to ignore the "height"?
There are at least two solutions found:
1) Make a weird selector path, like:
* html .dd_h { height: 18px; }
(.dd_h is the class name for the object which need the min-height)
2) Add the style property with an underscore ahead:
.dd_h { min-height: 18px; _height: 18px; }
In some reason IE processes such property as usual, and of course it's ignored by proper browsers.

Source:
http://www.cssplay.co.uk/boxes/minheight.html
http://sandgroper14.wordpress.com/2007/05/24/css-min-height-issue-solved/