Click here to Skip to main content
12,945,066 members (50,277 online)
Click here to Skip to main content


240 bookmarked
Posted 12 Jun 2007

Vista UAC: The Definitive Guide

, 21 Mar 2008 CPOL
Learn how UAC operates behind the scenes. Use the Elevate package to start multiple elevated processes but only display one UAC elevation dialog from a non-elevated process.
#include "CoreLib.h"
//#include <vld.h>

int main(int argc, char **argv, char **envp)
  GxApp.Init(argc, argv, envp);

  BString TempData;
  Process TempProcess;
  Process::ProcessData TempProcessData;

  TempData = System::AppDirectory("") + "TestChild.exe";

  if (!TempProcessData.Extract(TempData))
    printf("Error extracting information.\n");

    return 1;

  // Run the TestChild process with forced elevation,
  // waiting for it to complete,
  // attached to this console,
  // and pipe stderr to internal buffers.
  if (!TempProcess.StartProcess(TempProcessData.Command, TempProcessData.Argv, TempProcessData.Envp, TempProcessData.Directory, BString(), Process::Foreground, Process::Standard, Process::Piped, Process::NoDetachProcess, Process::ForceElevate))
    printf("Error running process.\n");

    return 1;

  // Data should have come across the named pipe for stderr.
  printf("Data from TestChild.exe:  \"%s\"", *TempProcess.ReadStderr());

  return 0;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Thomas Hruska
Web Developer
United States United States
Been writing software for a really long time - something like 18 years. Started on the TI/99-4A, moved to the Tandy 1000, and somehow managed to skip all the lousy hardware/software jumps (286, 386, first Pentiums, Win95, etc.)

I now run a small software business called CubicleSoft with a few products you might be interested in. VerifyMyPC and MyUpdate Toolkit are the most popular. I'm also the author of a book called "Safe C++ Design Principles".

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 22 Mar 2008
Article Copyright 2007 by Thomas Hruska
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid