Click here to Skip to main content
14,773,818 members
Home » Discussions » .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Cannot get data to display in textbox from the database vb.net Pin
Member 1257814224-May-17 12:43
MemberMember 1257814224-May-17 12:43 
GeneralRe: Cannot get data to display in textbox from the database vb.net Pin
Richard Deeming25-May-17 2:01
mveRichard Deeming25-May-17 2:01 
GeneralRe: Cannot get data to display in textbox from the database vb.net Pin
NotPolitcallyCorrect25-May-17 3:39
MemberNotPolitcallyCorrect25-May-17 3:39 
SuggestionRe arranging the display on the list view Pin
Member 1257814219-May-17 10:03
MemberMember 1257814219-May-17 10:03 
GeneralRe: Re arranging the display on the list view Pin
Richard MacCutchan19-May-17 22:30
mveRichard MacCutchan19-May-17 22:30 
QuestionConnecting to remote server <IP> failed with the following error message. Pin
Y_Kaushik19-May-17 3:54
MemberY_Kaushik19-May-17 3:54 
AnswerRe: Connecting to remote server <IP> failed with the following error message. Pin
Richard Deeming23-May-17 2:28
mveRichard Deeming23-May-17 2:28 
QuestionCalling a Console Application with Elevated rights opening Windows continuously Pin
indian1431-May-17 9:59
Memberindian1431-May-17 9:59 
Hi,

I have a console Application (AppA) which is calling another Console Application (AppV) with Elevated rights, problem is when I run the first Application AppA its opening many Consoles of AppB without limit continuously.
Here is my Code, any advice is going to be very helpful, thanks in advance.
    class Program
    {
        public static int ERROR_CANCELLED { get; private set; }

        private static bool IsRunAsAdmin()
        {
            WindowsIdentity id = WindowsIdentity.GetCurrent();
            WindowsPrincipal principal = new WindowsPrincipal(id);

            return principal.IsInRole(WindowsBuiltInRole.Administrator);
        }

        static void Main(string[] args)
        {
            if (!IsRunAsAdmin())
            {
                ProcessStartInfo proc = new ProcessStartInfo(@"C:\Personal Docs\FileWatcherBackups\20170221\FileWatcher\FileWatcherScheduleApp\bin\Release\FileWatcherScheduleApp.exe");
                proc.UseShellExecute = true;
                proc.WorkingDirectory = Environment.CurrentDirectory;
                proc.FileName = Assembly.GetEntryAssembly().CodeBase;
                proc.WindowStyle = ProcessWindowStyle.Normal;
                //proc.FileName = myExePath;
                proc.CreateNoWindow = false;
                //proc.UseShellExecute = false;

                proc.Verb = "runas";

                try
                {
                    Process.Start(proc);
                }
                catch (Win32Exception ex)
                {
                    if (ex.NativeErrorCode == ERROR_CANCELLED)
                    { }
                    else
                    { }
                }
                catch
                {
                    Console.WriteLine("This application requires elevated credentials in order to operate correctly!");
                }

                Application.Exit();
           }
        }
    }

Where am I going wrong, is there any way I can control the calling of AppB from AppA here?

Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."
AnswerRe: Calling a Console Application with Elevated rights opening Windows continuously Pin
Dave Kreskowiak1-May-17 10:47
mveDave Kreskowiak1-May-17 10:47 
GeneralRe: Calling a Console Application with Elevated rights opening Windows continuously Pin
indian1431-May-17 11:04
Memberindian1431-May-17 11:04 
GeneralRe: Calling a Console Application with Elevated rights opening Windows continuously Pin
Dave Kreskowiak1-May-17 11:51
mveDave Kreskowiak1-May-17 11:51 
GeneralRe: Calling a Console Application with Elevated rights opening Windows continuously Pin
indian1431-May-17 14:07
Memberindian1431-May-17 14:07 
Question(VS 2008 - C# - Compact Framework) problem with e.Graphics.DrawString Pin
steve_949661327-Apr-17 5:27
professionalsteve_949661327-Apr-17 5:27 
AnswerRe: (VS 2008 - C# - Compact Framework) problem with e.Graphics.DrawString Pin
Dave Kreskowiak27-Apr-17 5:44
mveDave Kreskowiak27-Apr-17 5:44 
GeneralRe: (VS 2008 - C# - Compact Framework) problem with e.Graphics.DrawString Pin
steve_949661327-Apr-17 6:21
professionalsteve_949661327-Apr-17 6:21 
QuestionVS 2017 Could not find required file 'setup.bin' in csproj folder Pin
Vitor_Silva26-Apr-17 11:07
MemberVitor_Silva26-Apr-17 11:07 
AnswerRe: VS 2017 Could not find required file 'setup.bin' in csproj folder Pin
Richard MacCutchan26-Apr-17 22:11
mveRichard MacCutchan26-Apr-17 22:11 
QuestionHow to install SignTool.exe for VS 2017? Pin
Vitor_Silva26-Apr-17 5:43
MemberVitor_Silva26-Apr-17 5:43 
AnswerRe: How to install SignTool.exe for VS 2017? Pin
Vitor_Silva26-Apr-17 6:18
MemberVitor_Silva26-Apr-17 6:18 
AnswerRe: How to install SignTool.exe for VS 2017? Pin
User 418025426-Apr-17 6:42
MemberUser 418025426-Apr-17 6:42 
GeneralRe: How to install SignTool.exe for VS 2017? Pin
Vitor_Silva26-Apr-17 9:49
MemberVitor_Silva26-Apr-17 9:49 
QuestionRun Applications as an Administrator using Scheduled Task Pin
indian14325-Apr-17 14:36
Memberindian14325-Apr-17 14:36 
QuestionType thanglish in keyboard when display tamil letters in textbox Pin
Member 1296305725-Apr-17 2:34
MemberMember 1296305725-Apr-17 2:34 
AnswerRe: Type thanglish in keyboard when display tamil letters in textbox Pin
User 418025425-Apr-17 2:59
MemberUser 418025425-Apr-17 2:59 
AnswerRe: Type thanglish in keyboard when display tamil letters in textbox Pin
Afzaal Ahmad Zeeshan25-Apr-17 3:51
mveAfzaal Ahmad Zeeshan25-Apr-17 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.