Thursday, July 23, 2015

Task killer with new features. End the processes easy. C delay, store in file

The New version of task killer, features:

1) Delay on execution, and ability to change the process-name

 Download Here: Download



Code in C
-----------------------------------
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <windows.h>
#define length 30



//delay code-block
void delay (unsigned int secs) {
    unsigned int retTime;
    retTime = time(0) + secs;     // Get finishing time.
    while (time(0) < retTime);    // Loop until it arrives.
}

int main(void)
{
    char str[length];
    char command[length];
    int i;
    int name_change;    //To change the process name in the file.log
    FILE *file;         //My text file where i store the process name
   
   
    name_change=0;
   
   
   
   
    //new vls start
    printf ("If you want to change the process name \nPress continiusly the Shift Key\n");
   
    for (i=10;i>=0;i--)
    {
        delay(1);        //delay 10 seconds
        printf("\n");
        printf("Remaining secs: %d\n", i);

    //If enter is continiusly pressed, Then you can change the process name   
    if(GetAsyncKeyState(16 ) < 0)
        {
        printf("Shift is pressed\n");
        name_change=1;
        break;
        }
   
    //if(GetAsyncKeyState(16 ) < 0)
    //    printf("Shift is pressed");
    //if(GetAsyncKeyState(13 ) < 0)
    //    printf("Enter is pressed");

    }
   
   
   
   
    //new vls start
   
    fflush(stdin);
    if (name_change==1)
    {
        printf ("Give Proccess name: ");
        scanf ("%s", &str);
        printf ("you gave: %s\n");
       
       
        //file=fopen("keys.log","a+");     //To add new strings
        //fputs("Valantis",file);
       
        file=fopen("keys.log", "w+");    //To replace an old string with a new one
        fputs(str, file);
        fflush(file);
       
    }
   
    //test end
   
   
   

   
   
   
    //vls start
       fflush(stdin);    //new
    file=fopen("keys.log", "r");//"w+");    //To read from file (only)
    fseek(file, SEEK_SET, 0);

      
   
   


    /* Read and display data */
    fread(str, length, 1, file);
    //new
    int count=0;
    for (i=0;i<length;i++)
    {
   
    count+=1;
    //printf("Total Characters =%d",count);
    }
    //new
   
       fclose(file);
    //vls end
   
    strcpy(command, "taskkill /F /IM ");
    strcat(command, str);
    strcat(command, ".exe");
   
    printf ("\n");
    //printf("%s\n", command);
   
    system (command);
   
   

return 0;
}


-----------------------------------

No comments:

Post a Comment