Tuesday, October 18, 2011

How To Download A File From Internet Without Prompting Using Visual Basic VB6


The declaration for URLDownloadToFile is shown below.

'API function for How to save or download webpages and files without Prompting :

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long



The function can be called as

returnValue = URLDownloadToFile(0, "http://www.google.com/", _
"c:\google.html", 0, 0)


Sample project , Copy and paste the code given below : Download sample project


Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Private Sub Command1_Click()

returnValue = URLDownloadToFile(0, "http://www.google.com/", _
"c:\google.html", 0, 0)

End Sub


Tags : How to download files in vb without prompting,save download files from internet using vb ,copy files from internet using vb without user's knowledge , how to pause and resume downloading files using vb ,save webpages using vb without prompting

C++ Program To Add Subtract Multiply Divide Complex Numbers

Aim 
To write a C++ Program to add subtract multiply divide complex numbers using structure .
Program

#include<iostream>
using namespace std;
main()
{
 float a1,a2,d1,d2;
 struct complex
 {
  float a,b;
 };
complex c1,c2;
cout<<"Enter the real and imaginary part of 2 the complex number";
cin>>c1.a>>c1.b>>c2.a>>c2.b;
cout<<"The Entered complex number is  ";
cout<<c1.a<<"+i"<<c1.b<<"\n"<<c2.a<<"+i"<<c2.b;
cout<<"\n The sum is\n";
a1=c1.a+c2.a;
a2=c1.b+c2.b;
cout<<a1<<"+i"<<a2<<"\n";
cout<<"The difference is "<<c1.a-c2.a<<"+"<<c1.b-c2.b<<"i\n";
cout<<"The product is "<<c1.a*c2.a-c1.b*c2.b<<"+"<<c1.a*c2.a+c1.b*c2.b;
cout<<"i\n";
cout<<"The quotient is ";
d1=((c1.a*c2.a)+(c1.b*c2.b))/((c2.a*c2.a)+(c2.b*c2.b));
d2=((c2.b*c1.a)-(c1.b*c2.a))/((c2.a*c2.a)+(c2.b*c2.b));
cout<<d1<<"+"<<d2<<"i";
return 0;
}




Tags: c++ program to solve complex numbers , c++ program to add complex numbers,c++ program to subtract complex numbers , c++ program to divide complex numbers,c++ program to multiply complex numbers ,algorithm , flowchart

C ++ Program To Find Area Of Rectangle Circle Triangle Pyramid Using Choice



Aim 
To write  a c plus plus program to find area of rectangle,circle,triangle and pyramid by using menu and choice.
Program 
#include<iostream>
#include<math.h>
using namespace std;
main()
{
 int area(int,int);
 float area(float,float,float);
 float area(float);
 double area(float,int);
int n;
cout<<"Menu\n";
cout<<"1.Rectangle\n";
cout<<"2.Circle\n";
cout<<"3.Triangle\n";
cout<<"4.Pyramid\n";
cout<<"Enter your choice\n";
cin>>n;
int l,br,p;
float a,b,c,r,d;
float m;
switch(n)
{
case 1: {
cout<<"Enter the length and breadth of a rectangle\n";
cin>>l>>br;
cout<<"The area of regtangle is "<<area(l,br)<<"\n";
break;
       }
case 2: {
cout<<"Enter the radius of a circle\n";
cin>>r;
cout<<"The area of circle is "<<area(r)<<"\n";
break;
}
case 3: {
cout<<"Enter the side of triangle\n";
cin>>a>>b>>c;
cout<<"The area of triangle is\n";
          d=area(a,b,c);
         cout<<d;
break;
}
case 4:{
cout<<"Enter the base and height of a pyramid\n";
cin>>m>>p;
cout<<"The area of a pyramid"<<area(m,p);
break;
}
}
return 0;
}
int area(int l,int br)
{
 return(l*br);

float area(float r)
{
return(3.14*r*r);
}
float area(float a,float b,float c)


{ float s,d;
 s=(a+b+c)/2.0;
d=sqrt(s*(s-a)*(s-b)*(s-c));
 return(d);
}
double area(float m,int p)
{
return((m*m)+(2*m*p));
}



Tags : c++ program to find area of rectangle , c++ program to find area of circle , c++ program to find area of triangle , c++ program to find area of pyramid , c++ program to find area using functions , algorithm to find area of triangle , circle , rectangle ,pyramid