Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Creating resources in Chinese Pin
Sheng Jiang 蒋晟23-Mar-05 5:24
Sheng Jiang 蒋晟23-Mar-05 5:24 
GeneralAdding scrollbars in custom static control Pin
Binsan22-Mar-05 23:33
Binsan22-Mar-05 23:33 
GeneralRe: Adding scrollbars in custom static control Pin
Monty223-Mar-05 2:21
Monty223-Mar-05 2:21 
GeneralSHA Encription Pin
Anand for every one22-Mar-05 23:05
Anand for every one22-Mar-05 23:05 
GeneralRe: SHA Encription Pin
Chris Losinger23-Mar-05 1:07
professionalChris Losinger23-Mar-05 1:07 
GeneralRe: SHA Encription Pin
Alexander M.,23-Mar-05 12:28
Alexander M.,23-Mar-05 12:28 
Generalprogram crushes!! Pin
mpapeo22-Mar-05 22:56
mpapeo22-Mar-05 22:56 
GeneralRe: program crushes!! Pin
Hans Ruck23-Mar-05 1:20
Hans Ruck23-Mar-05 1:20 
Try this:

#include "stdafx.h"<br />
#include <stdio.h><br />
<br />
int menu(void)<br />
{<br />
  int choice;<br />
  <br />
  printf ("\n");<br />
  printf ("*****************************************\n");<br />
  printf ("*\t\t\t\t\t*\n*\tCHECKPOINTING SYSTEM \t\t*\n");<br />
  printf ("=========================================");<br />
  printf ("\n=\t 1: Create a process \t=");<br />
  printf ("\n=\t 2: Shutdown the process\t=");<br />
  printf ("\n=========================================\n");<br />
  printf ("\n");<br />
  <br />
  printf("\nEnter choice (1-2): ");<br />
  scanf("%d", &choice);<br />
  return choice; <br />
}<br />
<br />
void main(int argc, char **argv) <br />
{<br />
  PROCESS_INFORMATION pi ; /* filled in by CreateProcess */<br />
  STARTUPINFO si; /* startup info for the new process*/<br />
  HANDLE hProcess;<br />
  TCHAR lpApplicationName[100]="";<br />
  <br />
  int choice;<br />
  <br />
  while((choice = menu())!=3)<br />
  {<br />
    switch (choice)<br />
    {<br />
    case 1: <br />
      printf("Enter process you want to execute: ",lpApplicationName);<br />
      scanf ("%s",lpApplicationName);<br />
      printf("Process %d reporting for creation\n",GetCurrentProcessId());//print out our process ID<br />
      GetStartupInfo(&si);<br />
      CreateProcess(NULL, /* lpApplicationName */<br />
        lpApplicationName, /* lpCommandLine assumes to use curent process directory*/<br />
        NULL, /* lpsaProcess */<br />
        NULL, /* lpsaThread */<br />
        FALSE, /* bInheritHandles */<br />
        CREATE_NEW_CONSOLE, /* dwCreationFlags */<br />
        NULL, /* lpEnvironment */<br />
        NULL, /* lpCurDir */<br />
        &si, /* lpStartupInfo */<br />
        &pi /* lpProcInfo */<br />
        ); <br />
      hProcess = pi.hProcess;<br />
      printf("New Process ID: %d ",pi.dwProcessId);<br />
      printf("has started \n"); <br />
      break;<br />
<br />
    case 2:<br />
      <br />
      TerminateProcess(pi.hProcess, 0);<br />
      break;<br />
<br />
    default:<br />
      printf("\nInvalid choice: ");<br />
    }<br />
  }<br />
}


And don't be as lazy as to believe anything you see...


 "though nothing
 will keep us together
 we can beat them
 for ever and ever"

 rechi
GeneralRe: program crushes!! Pin
mpapeo23-Mar-05 1:32
mpapeo23-Mar-05 1:32 
GeneralRe: program crushes!! Pin
Hans Ruck23-Mar-05 1:39
Hans Ruck23-Mar-05 1:39 
GeneralRe: program crushes!! Pin
mpapeo23-Mar-05 1:48
mpapeo23-Mar-05 1:48 
GeneralRe: program crushes!! Pin
Hans Ruck23-Mar-05 2:48
Hans Ruck23-Mar-05 2:48 
GeneralRe: program crushes!! Pin
mpapeo23-Mar-05 7:15
mpapeo23-Mar-05 7:15 
GeneralRe: program crushes!! Pin
mpapeo23-Mar-05 9:55
mpapeo23-Mar-05 9:55 
Questionhow to delete a string from a file? Pin
nehathoma22-Mar-05 22:47
nehathoma22-Mar-05 22:47 
AnswerRe: how to delete a string from a file? Pin
ThatsAlok23-Mar-05 0:07
ThatsAlok23-Mar-05 0:07 
GeneralRe: how to delete a string from a file? Pin
nehathoma23-Mar-05 0:21
nehathoma23-Mar-05 0:21 
GeneralRe: how to delete a string from a file? Pin
ThatsAlok23-Mar-05 1:01
ThatsAlok23-Mar-05 1:01 
GeneralRe: how to delete a string from a file? Pin
David Crow23-Mar-05 2:34
David Crow23-Mar-05 2:34 
GeneralMissing MFC Headers in Visual C++ 2005 express Pin
Ger Hayden22-Mar-05 22:34
Ger Hayden22-Mar-05 22:34 
GeneralRe: Missing MFC Headers in Visual C++ 2005 express Pin
Sheng Jiang 蒋晟23-Mar-05 5:13
Sheng Jiang 蒋晟23-Mar-05 5:13 
GeneralPreventing a View from being Closed Pin
RobHayles22-Mar-05 21:34
RobHayles22-Mar-05 21:34 
GeneralRe: Preventing a View from being Closed Pin
Abyss22-Mar-05 21:44
Abyss22-Mar-05 21:44 
GeneralRe: Preventing a View from being Closed Pin
RobHayles24-Mar-05 1:30
RobHayles24-Mar-05 1:30 
GeneralRe: Preventing a View from being Closed Pin
Steen Krogsgaard23-Mar-05 2:10
Steen Krogsgaard23-Mar-05 2:10 

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.