R
Ralf Heitmann
Hi there,
I need to find out the "Entry Assembly" in CompactFramework.
The full FX implements "Assembly.GetEntryAssembly()" for that case.
I also found in this newsgroup a hint to implement this code
(GetModuleFileName with P/Invoke).
[DllImport("CoreDll.dll", SetLastError=true)]
public static extern IntPtr GetModuleHandle(IntPtr ModuleName);
[DllImport("CoreDll.dll", SetLastError=true)]
public static extern Int32 GetModuleFileName(IntPtr hModule, StringBuilder
ModuleName, Int32 cch);
private static string GetEntryAssembly()
{
StringBuilder sb = null;
IntPtr hModule = GetModuleHandle(IntPtr.Zero);
if (IntPtr.Zero != hModule)
{
sb = new StringBuilder(255);
if (0 == GetModuleFileName(hModule, sb, sb.Capacity))
{
sb = null;
}
}
return sb.ToString();
}
But the important Drawback of this solution is that this code doesn't work
when I start the Executable on WindowsXP.
1. Is there any other alternative to get the Entry Assembly?
2. How can get information about the running OS (WindowsXP) when I execute
my CF code?
Anyone done this?
Thanks Ralf
I need to find out the "Entry Assembly" in CompactFramework.
The full FX implements "Assembly.GetEntryAssembly()" for that case.
I also found in this newsgroup a hint to implement this code
(GetModuleFileName with P/Invoke).
[DllImport("CoreDll.dll", SetLastError=true)]
public static extern IntPtr GetModuleHandle(IntPtr ModuleName);
[DllImport("CoreDll.dll", SetLastError=true)]
public static extern Int32 GetModuleFileName(IntPtr hModule, StringBuilder
ModuleName, Int32 cch);
private static string GetEntryAssembly()
{
StringBuilder sb = null;
IntPtr hModule = GetModuleHandle(IntPtr.Zero);
if (IntPtr.Zero != hModule)
{
sb = new StringBuilder(255);
if (0 == GetModuleFileName(hModule, sb, sb.Capacity))
{
sb = null;
}
}
return sb.ToString();
}
But the important Drawback of this solution is that this code doesn't work
when I start the Executable on WindowsXP.
1. Is there any other alternative to get the Entry Assembly?
2. How can get information about the running OS (WindowsXP) when I execute
my CF code?
Anyone done this?
Thanks Ralf