Search GOOGLE from Command Line

Mahen 0 Tallied Votes 198 Views Share

This program allows u to search the Search Engine of GOOGLE from the command line. Just type MUPROG "searchtext"
GIMME LOTZ OF STARZ

//******************************************************
//   Title:  Google

//   File:   Google.exe

//   Description:  A program to Search on the Famous Search Engine From Command Line.

//   Author:  Mahen

//   Developped:   Pentium 3 733 Mhz, 192MB Ram, Windows XP Pro

//   Target:   Platform Independent

//   Revision History:   Completed in 1 day.

// Comment: You have the right to modify the Source Code as you wish, but you must not claim this Original Source as yours.  

//*****************************************************
#include <iostream.h>
#include <string.h>
#include <windows.h>
#include <stdlib.h>
#include <shellapi.h>
HWND hWnd;
int main(int argc, char **argv)
{
 int color;   
 HANDLE  Console;
 Console = GetStdHandle(STD_OUTPUT_HANDLE);
 color = 14;
 SetConsoleTextAttribute(Console, color);   
 cout << "Welcome To My Program. Note That To Search For More Than One\nWord Do It As Follows: \"Search+Engine\n\n";
 color = 7;
 SetConsoleTextAttribute(Console, color);
    
 char myapi[50];
 char *arg = "http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2002-52,GGLD:en&q=";
 char exec[100];
 strcpy(exec, arg);
 if (argc == 2)
 {
   strcat(exec, argv[1]);
 }
 else
 {
    cout << "Please enter a Command!!";
    return 0;
 }
 cout << exec;
 ShellExecute(hWnd, "open", exec, NULL, NULL, SW_SHOWNORMAL);
 return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.