Conflicting permissions
-
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.
-
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.
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 -
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 KreskowiakLast 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.
-
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.
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);
}