Compact Framework does not support Assembly.GetEntryAssembly for determining .exe startup. So, is there any other way to get the name of the executable .exe?
EDIT: I found the answer to the Peter Foot blog: http://peterfoot.net/default.aspx Here is the code:
byte[] buffer = new byte[MAX_PATH * 2]; int chars = GetModuleFileName(IntPtr.Zero, buffer, MAX_PATH); if (chars > 0) { string assemblyPath = System.Text.Encoding.Unicode.GetString(buffer, 0, chars * 2); } [DllImport("coredll.dll", SetLastError = true)] private static extern int GetModuleFileName(IntPtr hModule, byte[] lpFilename, int nSize);
source share