Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Conflicting permissions

Conflicting permissions

Scheduled Pinned Locked Moved C#
csharpquestiontutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dell Simmons
    wrote on last edited by
    #1

    I've kind of programmed myself into a corner. I just changed my application to use David Hall's Task Scheduler Library for Net, so now the app requires elevated permissions (run as Administrator). However, I discovered that when I 'run as administrator' the app's connection to QuickBooks fails. Some research led me to find that the QuickBooks SDK will not work with elevated permissions on Windows 7. So now part of my app requires elevated permission and part of it requires non-elevated permission. I think I can get around this by splitting the task scheduler code off in a separate process like this example: "A new process with elevated privileges can be spawned from within a .NET application using the "runas" verb. An example using C#:"

    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo.FileName = "C:\\Windows\\system32\\notepad.exe";
    proc.StartInfo.Verb = "runas"; // Elevate the application
    proc.Start();

    So my question is, is this the only way? Are there other, better alternatives? Thanks.

    D A 2 Replies Last reply
    0
    • D Dell Simmons

      I've kind of programmed myself into a corner. I just changed my application to use David Hall's Task Scheduler Library for Net, so now the app requires elevated permissions (run as Administrator). However, I discovered that when I 'run as administrator' the app's connection to QuickBooks fails. Some research led me to find that the QuickBooks SDK will not work with elevated permissions on Windows 7. So now part of my app requires elevated permission and part of it requires non-elevated permission. I think I can get around this by splitting the task scheduler code off in a separate process like this example: "A new process with elevated privileges can be spawned from within a .NET application using the "runas" verb. An example using C#:"

      System.Diagnostics.Process proc = new System.Diagnostics.Process();
      proc.StartInfo.FileName = "C:\\Windows\\system32\\notepad.exe";
      proc.StartInfo.Verb = "runas"; // Elevate the application
      proc.Start();

      So my question is, is this the only way? Are there other, better alternatives? Thanks.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Do what? Run half the app as elevated and the other not? No. The elevated portion must run as a seperate process. There is no such thing as running the app as both at the same time.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      D 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Do what? Run half the app as elevated and the other not? No. The elevated portion must run as a seperate process. There is no such thing as running the app as both at the same time.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        D Offline
        D Offline
        Dell Simmons
        wrote on last edited by
        #3

        Last night I came to the conclusion that it could not be done. But it's always difficult to prove a negative, so thanks for the confirmation.

        1 Reply Last reply
        0
        • D Dell Simmons

          I've kind of programmed myself into a corner. I just changed my application to use David Hall's Task Scheduler Library for Net, so now the app requires elevated permissions (run as Administrator). However, I discovered that when I 'run as administrator' the app's connection to QuickBooks fails. Some research led me to find that the QuickBooks SDK will not work with elevated permissions on Windows 7. So now part of my app requires elevated permission and part of it requires non-elevated permission. I think I can get around this by splitting the task scheduler code off in a separate process like this example: "A new process with elevated privileges can be spawned from within a .NET application using the "runas" verb. An example using C#:"

          System.Diagnostics.Process proc = new System.Diagnostics.Process();
          proc.StartInfo.FileName = "C:\\Windows\\system32\\notepad.exe";
          proc.StartInfo.Verb = "runas"; // Elevate the application
          proc.Start();

          So my question is, is this the only way? Are there other, better alternatives? Thanks.

          A Offline
          A Offline
          ambarishtv
          wrote on last edited by
          #4

          try this shell command

          using System.Diagnostics;
          using Microsoft.VisualBasic;

          private void button1_Click(object sender, System.EventArgs e)
          {
          Interaction.Shell("C:\\Documents and Settings\\Jerry\\My Documents\\Calck.exe", (AppWinStyle) 2, false, -1);
          }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups