Halo, ist es möglich, das Programm so abzurichten, das es beim ersten start mit Admin-rechte starte und sie dann verliert ?
Mein Code ist momentan der
Mein Code ist momentan der
C#-Quellcode
-
- private string fontfolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
- private void Form1_Load(object sender, EventArgs e)
- {
- string fontpath = Path.Combine(fontfolder, "manteka.ttf");
- try
- {
- if (!File.Exists(fontpath))
- FontInstaller(fontpath, Properties.Resources.manteka);
- }
- catch
- {
- MessageBox.Show("Als Administrator ausführen");
- Application.Exit();
- }
- }
- [PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
- public void FontInstaller(string fontpath,byte[] fontfamily)
- {
- File.WriteAllBytes(fontpath, fontfamily);
- }