using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows; namespace eDosStation { /// /// Interaction logic for App.xaml /// public partial class App : Application { [DllImport("kernel32.dll",CharSet =CharSet.Auto, EntryPoint = "LoadLibraryEx")] private static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags); public System.IntPtr moduleHandle; public bool TestOrCreateFolder(string fn) { bool rv = true; try { if (!System.IO.Directory.Exists(fn)) { if (System.IO.File.Exists(fn)) System.IO.File.Delete(fn); System.IO.Directory.CreateDirectory(fn); } } catch { rv = false; } return rv; } private void Application_Startup(object sender, StartupEventArgs e) { //var pth1 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "EpdBaseClr.dll"); //var pth2 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reader2.dll"); //moduleHandle = LoadLibraryEx(pth2, IntPtr.Zero, 0); //moduleHandle = LoadLibraryEx(pth1, IntPtr.Zero, 0); TestOrCreateFolder("c:/temp"); TestOrCreateFolder("c:/Logs"); } private void Application_Exit(object sender, ExitEventArgs e) { Environment.Exit(0); } } }