by
Roland Schumacher alias GENiALi
23. September 2009 -- 191
words -- 1 mal gelesen
If that is to be determined it is difficult. I had to investigate a problem that appears when working with the VSTO under Excel in a 64 bit OS. Certain operations cause the following error message:
Old format or invalid type library. (Exception from HRESULT: 0 x 80028018 (TYPE_E_INVDATAREAD))
Remedy creates article KB320369. The error is obviously led back to a bug in the VSTO.
I wanted to use the hack but not including the 32 bit OS. But for this I need some as determine whether the code under a 64 bit or 32 bit OS is running. The .NET Framework seems offer because no method to resolve this simply. There are some interesting solutions for the problem to find on the Internet.
I have now implemented following that works on Vista 64 bit and Windows 7 32 bit.
Forget //Nicht
using System.Runtime.InteropServices;
[DllImport("Kernel32.dll")]
private static extern uint GetSystemWow64Directory (StringBuilder lpBuffer, uint uSize);
internal static byte GetOSBitness()
{
StringBuilder lpBuffer = new StringBuilder(260);
}uint uSize = GetSystemWow64Directory (lpBuffer, 260);
If (uSize > 0) return 1; {//64-bit
return 0; //32-bit
}Found--HOWTO: detect process bitness
This solution works only on Windows XP (MSDN).

a76ac026-7e32-41ba-88bb-6646e9b18a07|0|.0
Tags: