DYNAMIC HTTP WEB SERVER
Source Code
The files to be included in the Project are:
Welcome.h
// this class is used to load homepage
// filename :Welcome.h
class welcome_htm
{
CString wel;
int len_head;
public :
welcome_htm()
{
len_head=0;
wel ="HTTP/1.0 200 OK\r\n";
wel = wel+ "Content-length:670\r\n\r\n";
wel=wel +"<html>\r\n";
wel =wel +"<head>\r\n";
wel=wel +"<title>project welcome page</title>\r\n";
wel=wel +"</head> \r\n";
wel=wel +"<body text=yellow bgcolor=";
wel=wel +"black";
wel=wel +">\r\n";
wel= wel +"<hr><hr>\r\n";
wel= wel +"<h1><font color=red><i><b><u><center>Welcome To The Mukhi Cars Ltd.</center></b></i></h1></u></font><hr>\r\n";
wel= wel +"<img src=\"GYPSY.gif\" align=right height=60 width=90>\r\n";
wel= wel +"<img src= \"GYPSY.gif\" align=right height=60 width=90>\r\n";
wel= wel +"<img src= \"GYPSY.gif\" align=right height=60 width=90>\r\n";//
wel= wel +"<img src= \"GYPSY.gif\" align=right height=60 width=90>\r\n";
wel= wel +"<h2><font color=green><i><u><b>Company Profile:</b></u></i></font></h2>\r\n";
wel= wel +"<hr>\r\n";
wel= wel +"<ul>\r\n";
wel= wel +"<font size=+1>\r\n";
wel= wel +"<li><font color=red>Welcome to The Mukhi Cars Ltd.</font><font color=red><i>\r\n";
wel= wel +"(<b>TMCL</b>).</i></font><font color=yellow>At TMCL we bring you the information";
wel= wel +"regarding the latest prices and models at India's leading car manufacturing";
wel= wel +"companies.We are the only Indian car dealers to give this service live on the internet.<br><br>";
wel= wel +"<li>Here we allow you to view the models of your choice.You can select a car of";
wel= wel +"your choice along with the accessories provided.<br><br>";
wel= wel +"<li>We then give you an estimated price of your choice and allow you to place an";
wel= wel +"order of the same.<br><br>";
wel= wel +"<li>Your order is then verified for the information given by you and you are then send";
wel= wel +"a form to confirm your information.<br><br>";
wel= wel +"<li>An email is then send to you.<br><br>";
wel= wel +"<li>You can now <a href=";
wel= wel +"company.htm </a>";
wel= wel +"<font color=red> click </font></a> away yourself to glory and discover the car of your dreams!!";
wel= wel +"</font></ul><hr><hr></html>";
}
int Getlenght()
{
int t;
return t=wel.GetLength();
}
LPTSTR GetBuff()
{
LPTSTR buff;
return buff=wel.GetBuffer(wel.GetLength());
}
};
// welcome.h ends here
// used to generate the company.html page for company selection
company2.h
// filename:company2.h
class company_htm
{
CString com;
public :
company_htm()
{
com= "HTTP/1.0 200 OK\r\n";
com = com + "Content-length:350\r\n\r\n";
com=com+"<HTML>";
com=com+"<HEAD>";
com=com+"<TITLE>Companies Registered In Our DataBases</TITLE>";
com=com+"</HEAD>";
com=com+"<BODY text=yellow bgcolor=black><hr>";
com=com+"<H1><center><font color=red>COMPANY LIST</center></font></H1> ";
com=com+"<H2><center>Use this form to select your company</center></H2><hr>";
com=com+"<Form Method=\"GET\" Action=\"model.htm\">";
com=com+"<Table>";
com=com+"<th>Companies";
com=com+"<tr><td>";
com=com+"<select name=\"company_selected\">";
}
// used to add company name and the models of company
void add_company(CString add_company,CString model)
{
TCHAR ch='"';
com=com+"<option value="+ ch + model +ch ;
com =com + ">" + add_company ;
com =com + "\r\n";
}
void update()
{
com=com+"</select>";
com=com+"</table><hr>";
com=com+"<br>";
com=com+"<input type=submit value=\"Next\">";
com=com+"<a href=><b>Home page</b></a>";
com=com+"</FORM>";
com=com+"</html>";
}
int Getlenght()
{
int t;
return t=com.GetLength();
}
LPTSTR GetBuff()
{
LPTSTR buff;
return buff=com.GetBuffer(com.GetLength());
}
};
// company2.h ends here
model1.h
// used to load the models of company selected
// filename:model1.h
class model_htm
{
public:
CString mod;
//company_selected is variable selected from company2.h
model_htm(CString company_selected)
{
mod="HTTP/1.0 200 OK\r\n";
mod = mod+ "Content-length:230\r\n\r\n";
mod=mod + "<HTML>";
mod=mod+"<HEAD>";
mod=mod+"<TITLE>"+company_selected+"</TITLE>";
mod=mod+"</HEAD>";
mod=mod+"<BODY text=yellow bgcolor=black><hr>";
mod=mod+"<H1><center><font color=red>"+company_selected+"</center></font></H1>";
mod=mod+"<H2><center>Use this form to select your model</center></H2><hr>";
mod=mod+"<Form Method=\"GET\" Action=\"result.htm\">";
mod=mod+"<Table>";
mod=mod+"<th>Models";
mod=mod+"<tr><td>";
mod=mod+"<select name=\"~model\">";
}
// model_selected is variable from ODBC file modelset.cpp
void model_add(CString model_selected)
{
mod=mod+"<option value=\""+model_selected+"\">"+model_selected;
}
void model_update()
{
mod=mod+"</select>";
mod=mod+"<tr></table><hr>";
mod=mod+"<b>Air Conditioner?<input type=\"Checkbox\" value=\"true\" name=\"AC\">";
mod=mod+"Audio System?<input type=\"checkbox\" Value=\"true\" name=\"Audio System\" checked><hr>";
mod=mod+"</b><br>";
mod=mod+"<input type=submit value=\"Estimated price\">";
mod=mod+"<input type=reset> <br> <br><hr>";
mod=mod+"<a href=><b>Back To Home Page</b></a>";
mod=mod+"</FORM></html>";
}
int Getlenght()
{
int t;
return t=mod.GetLength();
}
LPTSTR GetBuff()
{
LPTSTR buff;
return buff=mod.GetBuffer(mod.GetLength());
}
};
// model1.h ends here
Welcome.h
result1.h
//used to generate the result1.html page
//filename :result1.h
// passed parameters are company selected ,model,speed,cost,mileage,weight from database model.dbf
class result_htm
{
public:
CString res;
CString cost_selected;
result_htm(CString company_selected,CString model_selected,CString speed,CString fuel,CString weight,CString cost)
{
res="HTTP/1.0 200 OK\r\n";
res=res +"Content-length:350\r\n\r\n";
//cost_selected="420";
res=res + "<html>";
res=res+"<head>";
res=res+"<title>result</title>";
res=res+"<body text=yellow bgcolor=black>";
res=res+"<font size=+4 font color=\"light blue\"><center><u><em><i><b>The Mukhi Cars Ltd.</b></em></u></i></center></font><ul>";
res=res+"<li><font size=+1 color=red><b>Company :<br> </b></font><b><i>"+company_selected+"</b></i>";
res=res+"<li><font size=+1 color=red><b>Model :<br> </b></font><b><i>"+model_selected+"</b></i>";
res=res+"<li><font size=+1 color=red><b>Statuts :<br> </b></font><b><i>This is a luxury class model from "+company_selected+"</b></i>";
res=res+"<li><font size=+1 color=red><b>Cost (including accessories) :<br> </b></font><b><i>"+cost+"</b></i></ul>";
res=res+"<u><font size=+1 font color=red>The car that YOU have selected is :</u></font> <font size=+1><i><b><blink> "+model_selected+"</i></b></blink></font><br>";
res=res+"<img src=\"" +model_selected+ ".gif\" align=right alt=\"sorry\"><b>";
res=res+"<font color=\"green\"><u><i>Technical Specifications:</i></u><br></font>";
res=res+"Unladen weight......"+weight+" Kg.<br>";
res=res+"Fuel Efficiency......."+fuel+ "km/lit<br>";
res=res+"Maximum Speed...."+speed+" kmh<br><br>";
res=res+"</form></body><hr><br>";
res=res+"Click <a href=\"regis.htm\">here</a> to place your order<br>";
res=res+"Thank You<hr><br><br><br>";
}
int Getlenght()
{
int t;
return t=res.GetLength();
}
LPTSTR GetBuff()
{
LPTSTR buff;
return buff=res.GetBuffer(res.GetLength());
}
};
// result1.h ends here
regis1.h
// used to generate the registration form page
//filename :regis1.h
// will receive input parameters are FirstName ,LastName.Email Address
class regis
{
public:
CString reg;
regis(int i)
{
reg= "HTTP/1.0 200 OK\r\n";
reg = reg+ "Content-length:350\r\n\r\n";
reg=reg + "<html>";
reg=reg + "<head>";
reg=reg + "<title>";
reg=reg + "The Muhki Cars ltd.";
reg=reg + "</title>";
reg=reg + "<body text=red bgcolor=black>";
reg=reg + "<hr>";
// if i==1) is to check for validity of Email Address
if (i==1)
reg = reg + "<b>please enter a valid email address</b>";
reg=reg + "<font size=+3 font color=yellow><center><i><u>The Mukhi Cars Ltd.</i></u></center></font>";
reg=reg + "<hr>";
reg=reg + "<font color=green><b><i> Please enter your Name Correctly. i.e both, your First name & your last name.</b></i><br><b><i> Please enter a <blink><font color=blue>VALID</font></blink> Email Address.</b></i><br><b><font color=blue>Thank You</font></b><br><hr><center></font>";
reg=reg + "<form method=get action=>";
reg=reg + "<table border=0 widht=60%>";
reg=reg + "<th Align=left>First Name";
reg=reg + "<th align=left colspan=2>Last Name";
reg=reg + "<tr>";
reg=reg + "<td>";
reg=reg + "<input type=text size=10 maxlength=20 name=\"First name\">";
reg=reg + "<td colspan=2>";
reg=reg + "<input type=text size=32 maxlength=40 name=\"Last Name\" >";
reg=reg + "<tr>";
reg=reg + "<th align=left colspan=2><blink>Email Address</blink>";
reg=reg + "<tr>";
reg=reg + "<td><input type=text size=32 maxlength=32 name=\"Email Address\">";
reg=reg + "<tr>";
reg=reg + "<td width=50%><input type=submit name=simple value=\"Submit Registration\">";
reg=reg + "<td width=50%><input type=reset>";
reg=reg + "<tr>";
reg=reg + "</table>";
reg=reg + "</form>";
reg=reg + "</center><hr>";
reg=reg + "</body>";
reg=reg + "</html>";
}
int Getlenght()
{
int t;
return t=reg.GetLength();
}
LPTSTR GetBuff()
{
LPTSTR buff;
return buff=reg.GetBuffer(reg.GetLength());
}
};
// regis1.h ends here
email1.h
// used to send Email Reply to client
// returns -1 if not sent else returns 0
//filename :email1.h
class email
{
public :
email()
{
}
int sendmail(char *name,char *addr,char *modelname)
{
char aa[100];
int i;
struct sockaddr_in A;
SOCKET S;
struct hostent *H;
char R[10000];
S = socket(AF_INET, SOCK_STREAM,0);
A.sin_family=AF_INET;
A.sin_port = htons(25);
H=gethostbyname("giasbm01.vsnl.net.in");
A.sin_addr.s_addr=*((unsigned long *) H->h_addr);
i=connect(S,(struct sockaddr *) &A,sizeof(A));
strset(aa,' ');
i=recv(S,R,10000,0);
strset(aa,' ');
strcpy(R,"HELO test.com\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
strset(aa,' ');
strcpy(R,"MAIL FROM:<xyzcars@giasbm01.vsnl.net.in>\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
strset(aa,' ');
strcpy(R,"RCPT TO:<");
strcat(R,addr);
strcat(R,">\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
if(i!=18) return -1;
strset(aa,' ');
strcpy(R,"DATA\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
strcpy(R,"To: ");
strcat(R,name);
strcat(R,"\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
strcpy(R,"FROM: xyzcars@giasbm01.vsnl.net.in\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
strcpy(R,"DATE: 10 Jan 95 13:24 PST\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
strcpy(R,"MESSAGE_ID: <123@e.com>\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
strcpy(R,"Thanks for registering with us .\r\n");
strcat(R,"The Model you selected is :");
strcat(R,modelname);
strcat(R,"\r\n");
strcat(R,"You will be hearing soon from us.\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
strcpy(R,".\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
strset(aa,' ');
strcpy(R,"QUIT\r\n");
i=send(S,R,strlen(R),0);
strset(aa,' ');
i=recv(S,R,10000,0);
return 0;
}
};
// email1.h ends here
compset.h
// compset recordset relates company.dbf
//filename :compset.h
class compset : public CRecordset
{
public:
compset(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(compset)
CString m_NAME_COMP;
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
// compset.h ends here
// modelset.h : header file
// modelset recordset relates model.dbf
class modelset : public CRecordset
{
public:
modelset(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(modelset)
CString m_NAME_COMP;
CString m_MODEL;
double m_COST;
double m_SPEED;
double m_MILEAGE;
double m_WEIGHT;
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
// modelset.h ends here
resset.h
// resset.h : header file
//filename :resset.h
class resset : public CRecordset
{
public:
resset(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(resset)
// Field/Param Data
//{{AFX_FIELD(resset, CRecordset)
CString m_NAME_COMP;
CString m_MODEL;
double m_COST;
double m_SPEED;
double m_MILEAGE;
double m_WEIGHT;
//}}AFX_FIELD
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(resset)
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
// resset.h ends here
// cpp files to be included in the project workspace starts here also include
//wsock32.lib
compset.cpp
// compset.cpp : implementation file
//filename :compset.cpp use company.dbf file stored in current drive :\dbf
#include "stdafx.h"
#include "cs.h"
#include "compset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(compset, CRecordset)
compset::compset(CDatabase* pdb)
: CRecordset(pdb)
{
m_NAME_COMP = _T("");
m_nFields = 1;
m_nDefaultType = dynaset;
}
CString compset::GetDefaultConnect()
{
return _T("ODBC;DSN=company");
}
CString compset::GetDefaultSQL()
{
return _T("[COMPANY]");
}
void compset::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[NAME_COMP]"), m_NAME_COMP);
}
/////////////////////////////////////////////////////////////////////////////
// compset diagnostics
#ifdef _DEBUG
void compset::AssertValid() const
{
CRecordset::AssertValid();
}
void compset::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG
// compset.cpp ends here
resset.cpp
// resset.cpp : implementation file
// filename:resset.cpp
#include "stdafx.h"
#include "cs.h"
#include "resset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(resset, CRecordset)
resset::resset(CDatabase* pdb)
: CRecordset(pdb)
{
m_NAME_COMP = _T("");
m_MODEL = _T("");
m_COST = 0.0;
m_SPEED = 0.0;
m_MILEAGE = 0.0;
m_WEIGHT = 0.0;
m_nFields = 6;
m_nDefaultType = dynaset;
}
CString resset::GetDefaultConnect()
{
return _T("ODBC;DSN=company");
}
CString resset::GetDefaultSQL()
{
return _T("[MODEL]");
}
void resset::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[NAME_COMP]"), m_NAME_COMP);
RFX_Text(pFX, _T("[MODEL]"), m_MODEL);
RFX_Double(pFX, _T("[COST]"), m_COST);
RFX_Double(pFX, _T("[SPEED]"), m_SPEED);
RFX_Double(pFX, _T("[MILEAGE]"), m_MILEAGE);
RFX_Double(pFX, _T("[WEIGHT]"), m_WEIGHT);
}
/////////////////////////////////////////////////////////////////////////////
// resset diagnostics
#ifdef _DEBUG
void resset::AssertValid() const
{
CRecordset::AssertValid();
}
void resset::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG
// resset.cpp ends here
modelset.cpp
// modelset.cpp : implementation file
// filename modelset.cpp
#include "stdafx.h"
#include "cs.h"
#include "modelset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(modelset, CRecordset)
modelset::modelset(CDatabase* pdb)
: CRecordset(pdb)
{
m_NAME_COMP = _T("");
m_MODEL = _T("");
m_COST = 0.0;
m_SPEED = 0.0;
m_MILEAGE = 0.0;
m_WEIGHT = 0.0;
m_nFields = 6;
m_nDefaultType = dynaset;
}
CString modelset::GetDefaultConnect()
{
return _T("ODBC;DSN=company");
}
CString modelset::GetDefaultSQL()
{
return _T("[MODEL]");
}
void modelset::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[NAME_COMP]"), m_NAME_COMP);
RFX_Text(pFX, _T("[MODEL]"), m_MODEL);
RFX_Double(pFX, _T("[COST]"), m_COST);
RFX_Double(pFX, _T("[SPEED]"), m_SPEED);
RFX_Double(pFX, _T("[MILEAGE]"), m_MILEAGE);
RFX_Double(pFX, _T("[WEIGHT]"), m_WEIGHT);
}
/////////////////////////////////////////////////////////////////////////////
// modelset diagnostics
#ifdef _DEBUG
void modelset::AssertValid() const
{
CRecordset::AssertValid();
}
void modelset::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG
// modelset.cpp ends here
cs.cpp
// cs.cpp : Defines the class behaviors for the application.
// filename :cs.cpp
#include "stdafx.h"
#include "cs.h"
#include "resset.h"
#include "modelset.h"
#include "compset.h"
#include "MainFrm.h"
#include "csDoc.h"
#include "csView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CCsApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCsApp construction
CCsApp::CCsApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CCsApp object
CCsApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CCsApp initialization
BOOL CCsApp::InitInstance()
{
// Standard initialization
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register document templates
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCsDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CCsView));
AddDocTemplate(pDocTemplate);
// our code starts here
if(WSAStartup(0x0101,&ws))
{
MessageBeep(MB_ICONSTOP);
MessageBox(0,"Winsock couldn't be initialised !",AfxGetAppName(),0|1);
WSACleanup();
return FALSE;
}
// our code ends here
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CCsApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CCsApp commands
int CCsApp::ExitInstance()
{
// our code starts here
int error; //used for getting error code returned from WSACleanup()
char aa[100];
if( ( error = WSACleanup() ) )
{
sprintf(aa,"Error Code Returned By WinSock =%d",error);
::MessageBox(0,aa,AfxGetAppName(),0);
}
// our code ends here
return CWinApp::ExitInstance();
}
// cs.cpp ends here
MainFrm.cpp
// MainFrm.cpp : implementation of the CMainFrame class
//filename:MainFrm.cpp
#include "stdafx.h"
#include "cs.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
// mainframe.cpp ends here
csDoc.cpp
// csDoc.cpp : implementation of the CCsDoc class
// filename: csDoc.cpp
#include "stdafx.h"
#include "cs.h"
#include "resset.h"
#include "modelset.h"
#include "compset.h"
#include "csDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CCsDoc, CDocument)
BEGIN_MESSAGE_MAP(CCsDoc, CDocument)
//{{AFX_MSG_MAP(CCsDoc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCsDoc construction/destruction
CCsDoc::CCsDoc()
{
}
CCsDoc::~CCsDoc()
{
}
BOOL CCsDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CCsDoc serialization
void CCsDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
}
else
{
}
}
/////////////////////////////////////////////////////////////////////////////
// CCsDoc diagnostics
#ifdef _DEBUG
void CCsDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CCsDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCsDoc commands
// Csdoc.cpp ends here
csView.cpp
// csView.cpp : implementation of the CCsView class
// filename:csView.cpp
#include "stdafx.h"
#include "cs.h"
#include "email1.h"
#include "regis1.h"
#include "result1.h"
#include "resset.h"
#include "modelset.h"
#include "model1.h"
#include "compset.h"
#include "Welcome.h"
#include "company2.h"
#include <malloc.h>
#include<memory.h>
#include<winbase.h>
#include<process.h>
#include <windows.h>
#include<string.h>
#include<stdio.h>
#include "csDoc.h"
#include "csView.h"
char contentlen[10];
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// parser function and data
//and global variables
int success=1; //1==FALSE //variable TRUE if EMAIL is sent properly
int errorregis=0;
char *firstname= " ";
char *emailaddr=" ";
int welcomedone=0;
char *company_selected=" ";// buffer for company _selected
int carmod =0;
int cargone=0;
void get(char *);// parser function prototype
void abc(char *,int);// removing html query encapsulation special Symbols
char a[30];
char carmodel[30];// store the car model selected
char *filename1=" ";// buffer for various htm pages
int acc=0;
int acc0=0;
int totalacc[10];
char model[30];
char *acc1=" ";// buffer for accessories
char *acc2=" ";// buffer for accessories
char *p=" ";
// parser ends here
char *perl = "perl";
int abc(char *,char *);
int flag=1;
char *htmpage= " ";// used to send Html pages
char aa[200];
int size=0;
long start=0L;
long end=0L;
char *sendbuf= " ";// used in Winsock Send Function
char *start1;
char ch;
int ii=0;
/////////// flag for image request
int imagereq=0;
/////////////////////////////////////////////////////////////////////////////
// CCsView
IMPLEMENT_DYNCREATE(CCsView, CView)
BEGIN_MESSAGE_MAP(CCsView, CView)
//{{AFX_MSG_MAP(CCsView)
ON_MESSAGE(WM_SERVER_ACCEPT,OnServerAccept)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCsView construction/destruction
CCsView::CCsView()
{
}
CCsView::~CCsView()
{
}
BOOL CCsView::PreCreateWindow(CREATESTRUCT& cs)
{
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCsView drawing
void CCsView::OnDraw(CDC* pDC)
{
CCsDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
/////////////////////////////////////////////////////////////////////////////
// CCsView diagnostics
#ifdef _DEBUG
void CCsView::AssertValid() const
{
CView::AssertValid();
}
void CCsView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCsDoc* CCsView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCsDoc)));
return (CCsDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCsView message handlers
//pDoc->serveraddr
void CCsView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CCsDoc* pDoc = GetDocument();
parentWindow=GetParent();// used to get parent window handle to use in WSAAsynSelect function
pDoc->serversocket=socket(AF_INET, SOCK_STREAM,0);
pDoc->serveraddr.sin_family=AF_INET;
pDoc->serveraddr.sin_port = htons(80);
pDoc->serveraddr.sin_addr.s_addr =INADDR_ANY;
bind(pDoc->serversocket,(struct sockaddr *) &pDoc->serveraddr,sizeof(pDoc->serveraddr));
WSAAsyncSelect(pDoc->serversocket,m_hWnd,WM_SERVER_ACCEPT,FD_ACCEPT|FD_READ);
listen(pDoc->serversocket,100);
}
LRESULT CCsView::OnServerAccept(WPARAM wParam,LPARAM lParam)
{
char bb[2000];
char cc[100];
char qq[100];
char *sendbuff = " ";
long lenght;
memset(cc,0,100);
CCsDoc* pDoc = GetDocument();
int lenght1=sizeof(pDoc->serveraddr);
if(WSAGETSELECTERROR(lParam))
{
return(0L);
}
if(WSAGETSELECTEVENT(lParam)==FD_ACCEPT)
{
pDoc->clientsocket=accept(pDoc->serversocket,(struct sockaddr *) &pDoc->serveraddr,&lenght1);
return(0L);
}
if(WSAGETSELECTEVENT(lParam)==FD_READ)
{
recv(pDoc->clientsocket,bb,2000,0);//client send information in buffer bb
//::MessageBox(0,bb,"recieved ",0);
sendbuff= " ";
get(bb);// parse buffer bb
if(strcmp(filename1,"regis.htm")==0)
{
regis *file;
file = new regis(0);// send a valid registration form
int z=file->Getlenght();
welcomedone=0;
sendbuff=file->GetBuff();
z++;
sendbuff[z]='\0';
lenght=z;
company_selected=" ";
carmod=0;
}
if(strcmp(filename1,"Welcome.htm")==0)
{
welcome_htm *file; // sends Welcome.htm page
file = new welcome_htm;
int z=file->Getlenght();
welcomedone=0;
sendbuff=file->GetBuff();
z++;
company_selected=" ";
errorregis=0;
sendbuff[z]='\0';
lenght=z;
}
if(strcmp(filename1,"company.htm")==0)
{
m_pSetcompany=&GetDocument()->companydata;// sends company.htm page
m_pSetcompany->Open();
CString output;
company_htm *company;
company = new company_htm;
m_pSetcompany->MoveFirst();
CCsDoc* pDoc = GetDocument();
char aa[100];
while(!m_pSetcompany->IsEOF())
{
output.Format("%s",m_pSetcompany->m_NAME_COMP);
company->add_company(output,output);
m_pSetcompany->MoveNext();
}
m_pSetcompany->Close() ;
company->add_company(output,output);
company->update();
//ODBC stuff starts here
char qq[100];
int z=company->Getlenght();
sendbuff=" ";
sendbuff=company->GetBuff();
z++;
sendbuff[z]='\0';
lenght=z;
}
if(!strcmp(company_selected," "))
{
//::MessageBox(0,"company is not selected boss "," neeed to worry ",0);
//do nothing ....
}
else
{
int jj=0;
file(company_selected);
m_pSetmodel=&GetDocument()->modeldata;
m_pSetmodel->Open();
CString output,output1;
m_pSetmodel->MoveFirst();
CCsDoc* pDoc = GetDocument();
char aa[100];
model_htm *model_sent;
model_sent= new model_htm(company_selected);
while(!m_pSetmodel->IsEOF())
{
output.Format("%s",m_pSetmodel->m_NAME_COMP);
output1.Format("%s",m_pSetmodel->m_MODEL);
if(!strcmp(company_selected,output) )
{
model_sent->model_add(output1);
}
m_pSetmodel->MoveNext();
}
m_pSetmodel->Close();
model_sent->model_update();
char qq[100];
int z=model_sent->Getlenght();
sendbuff=" ";
sendbuff=model_sent->GetBuff();
z++;
sendbuff[z]='\0';
lenght=z;
sprintf(qq,"%d",z);
} // end of company_selected end;
// ***************** models ends here *************************
// ********************** generating result .htm ***************************
if(carmod!=1)
{
//::MessageBox(0,"result.htm "," don't generate it ",0);
//do nothing .....
}
else
{
CString output,output1,output3,output4,output5,output6,output7;
result_htm *res;
// file model opens here accessing through ODBC
m_pSetres=&GetDocument()->resdata;
m_pSetres->Open();
m_pSetres->MoveFirst();
CCsDoc* pDoc = GetDocument();
char aa[100];
int jj=0;
while(!m_pSetres->IsEOF())
{
output1.Format("%s",m_pSetres->m_MODEL);
if(!strcmp(carmodel,output1) )
{
output.Format("%s",m_pSetres->m_NAME_COMP);
output3.Format("%s",m_pSetres->m_MODEL);
output4.Format("%d",(int )m_pSetres->m_COST);
output5.Format("%d",(int)m_pSetres->m_SPEED);
output6.Format("%d",(int)m_pSetres->m_MILEAGE);
output7.Format("%d",(int)m_pSetres->m_WEIGHT);
res = new result_htm(output,output3,output5,output6,output7,output4);
}
m_pSetres->MoveNext();
}//end of while
m_pSetres->Close();
char qq[100];
int z=res->Getlenght();
sendbuff=res->GetBuff();
z++;
lenght=z;
sendbuff[z]='\0';
carmod=0;
cargone=0;
company_selected=" ";
}// ends for else 1
if(errorregis==1)
{ //if the email addr is not valid the send the same form
regis *file;
file = new regis(1);
int z=file->Getlenght();
welcomedone=0;
sendbuff=file->GetBuff();
z++;
sendbuff[z]='\0';
lenght=z;
company_selected=" ";
carmod=0;
errorregis=0;
}
// generation of result.htm ends here
char *image=filename1;
char *imagecheck;
imagecheck=strstr(image,".gif");
if(imagecheck!=NULL)
{
/////////image routine
int end=0;
int start=0;
int size=0;
char ch1;
char *sendimagebuf=" ";
char *startimage=" ";
FILE *imfp;
imfp=fopen(image,"r+b");
if(imfp==NULL)
{
//::MessageBox(0,"problemmmmmmmmmmmm","server",0);
//do nothing .....
}
else
{
char imagesent[67000];
memset(imagesent,0x32,67000);
sendbuff=" ";
//memset(imagesent,0x32,67000);
fread(imagesent,67000,1,imfp);
sendbuff=imagesent;
lenght=67000;
fclose(imfp);
}
/////////////////////image routine ends here
}
if(success==0)
{
welcome_htm *file;
file = new welcomd_htm;
int z=file->Getlenght();
welcomedone=0;
sendbuff=file->GetBuff();
z++;
company_selected=" ";
errorregis=0;
sendbuff[z]='\0';
lenght=z;
success = 1;
}
char tt[200];
sprintf(tt,"%d",lenght);
::MessageBox(0,"length to send ",tt,0);
send(pDoc->clientsocket,sendbuff,lenght,0);
sendbuff = " ";
return (0L);
}
return(0L);
}
// get() starts here
// parser routine starts here
// parsed according to the Query send to the server
void get(char *input)
{
char *next= " ";
char *filename=" ";
int i=0;
int j=0;
int m=0;
char a[30];
int count=0;
char *st;
input=input+5;
file(input);
count =0;
::MessageBox(0,input,"the original input",0);
while (1)
{
*(next+count) = *(input+count);
if( (*(input+count)=='H' ) && (*(input+count+1)=='T') && (*(input+count+2)=='T') && (*(input+count+3)=='P') )
{ break;
}
count ++;
}
count--;
// ::MessageBox(0,next,"the next",0);
/////////////////////
*(next+count++)=' ';
*(next+count++)='H';
*(next+count++)='T';
*(next+count++)='T';
*(next+count++)='P';
*(next+count++)='/';
*(next+count++)='1';
*(next+count++)='.';
*(next+count++)='0';
//strcat(next,"HTTP/1.0");
// ::MessageBox(0,next,"ON CHOPPING INPUT",0);
*(next+count)='\0';
::MessageBox(0,next,"ON CHOPPING INPUT",0);
m=strlen(input);
p=strstr(next,"?First+name");
if(p!=NULL)
{
p=strtok(next,"=");
next=next +strlen(p) +1;
p=strtok(next,"&");
if(p!=NULL)
{
strcpy(firstname,p);
strcat(firstname," ");
}
next=next +strlen(p) +1;
p=strtok(next,"=");
next=next +strlen(p) +1;
p=strtok(next,"&");
if (p!=NULL)
{
strcat(firstname,p);
}
next=next +strlen(p) +1;
p=strtok(next,"=");
next=next +strlen(p) +1;
p=strtok(next,"&");
if(p!=NULL)
{
p=strtok(next," ");
char *y=strstr(p,"@");
if(y!=NULL)
{
strcpy(emailaddr,p);
::MessageBox(0,"Email ",p,0);
email *mail;
mail= new email;
success=mail->sendmail(firstname,emailaddr,carmodel);
if (success==0)
{
::MessageBox(0,"email ","sent ",0);
errorregis=0;
emailaddr=" ";
strset(carmodel,' ');
strcpy(company_selected," ");
carmod=0;
// strcpy(filename1,"Welcome.htm");
}
else
{
filename1=" ";
::MessageBox(0,"error","not sent ",0);
errorregis=1;
success = 1;
}
}
company_selected= " ";
}
}
else
{
p=strtok(next,"1");
p=strstr(next,"?");
if(p!=NULL)
{
p=strstr(next,"_");
if (p!=NULL)
{
p=strtok(next,"=");
next=next+strlen(p)+1;
p=strstr(next," ");
if (p!=NULL)
{
p=strtok(next," ");
abc(p,2);
}
}
else
{
p=strtok(next,"?");
next=next+strlen(p)+1;
strcpy(filename1,p);
p=strstr(next,"%");
if (p!=NULL) carmod=1;
p=strstr(next,"=");
if(p!=NULL)
{
p=strtok(next,"=");
next=next+strlen(p)+1;
p=strstr(next,"&");
while(p!=NULL)
{
p=strtok(next,"&");
next=next+strlen(p)+1;
if (cargone==0)
{
abc(p,3);
carmod=1;
cargone=1;
}
else abc(p,1);
p=strstr(next,"&");
}
p=strstr(next," ");
if (p!=NULL)
{
p=strtok(next," ");
next=next+strlen(p)+1;
abc(p,1);
}
}
else
{
printf("no = found");
//do nothing ...for debugging only
}
}
}
else
{
filename=strstr(next,".");
if(filename!=NULL)
{
filename=strtok(next," ");
strcpy(filename1,filename);
}
else
{
welcomedone=1;
carmod=0;
company_selected=" ";
strcpy(filename1,"Welcome.htm");
printf("default.htm\n");
///for debugging only
}
}
}// end of Email Else
}
// get ends here
// abc () starts here
void abc(char *got,int i)// i tells us to do what
{
int j=0;
int ii=0;
ii=i;
if(i==1 || i==2 ||i==3)
{
j=strlen(got);
i=0;
while(i!=j)
{
if(*(got+i)=='=')
{
a[i]='\0';
acc0=1;
i=j+1;
if(acc==0)
{
strcpy(acc1,a);
acc=1;
acc2=" ";
return ;
}
if(acc==1) strcpy(acc2,a);
return;
}
if(*(got+i)=='+')
{
if (ii==3) carmodel[i]=' ';
a[i]=' ';
acc0=1;
}
else
{
if (ii==3) carmodel[i]=*(got+i);
a[i]=*(got+i);
}
i++;
}
if(ii==3)
{ // i=3 means received carmodel
carmod=1;
carmodel[i]='\0';
i=0;
}
if (ii==1){a[i]='\0'; strcpy(model,a);i=0;}// i=1 means model name
if (ii==2)
{// i=2 means companyselected
filename1=" ";
company_selected=" ";
a[i]='\0';
strcpy(company_selected,a);
i=0;
}
a[i]='\0';
}
}
// abc() ebds here
// csview.cpp ends here
// stdafx.cpp : source file that includes just the standard includes
// cs.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
StdAfx.cpp
//filename:StdAfx.cpp
#include "stdafx.h"
// The following are the header files for cpp
stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
// File name: STDAFX.H
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows 95 Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include<winsock.h>
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows 95 Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
// stdafx.h ends here
csDoc.h
// csDoc.h : interface of the CCsDoc class
// filename:csDoc.h
/////////////////////////////////////////////////////////////////////////////
class CCsDoc : public CDocument
{
protected: // create from serialization only
CCsDoc();
DECLARE_DYNCREATE(CCsDoc)
// Attributes
public:
compset companydata;
modelset modeldata;
resset resdata;
SOCKET serversocket;// server socket
sockaddr_in serveraddr; // server address structure
SOCKET clientsocket;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCsDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CCsDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CCsDoc)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//csDoc.h ends here
csView.h
// csView.h : interface of the CCsView class
//filename :csView.h
/////////////////////////////////////////////////////////////////////////////
class CCsView : public CView
{
compset *m_pSetcompany;
modelset *m_pSetmodel;
resset *m_pSetres;
protected: // create from serialization only
CCsView();
DECLARE_DYNCREATE(CCsView)
// Attributes
public:
CCsDoc* GetDocument();
CWnd *parentWindow;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCsView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CCsView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CCsView)
afx_msg LRESULT OnServerAccept(WPARAM wParam,LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in csView.cpp
inline CCsDoc* CCsView::GetDocument()
{ return (CCsDoc*)m_pDocument; }
#endif
//csView.h ends here
// cs.h : main header file for the CS application
//
#include "stdafx.h"
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
cs.h
/////////////////////////////////////////////////////////////////////////////
// CCsApp:
// See cs.cpp for the implementation of this class
// filename :cs.h
class CCsApp : public CWinApp
{
public:
CCsApp();
WSADATA ws;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCsApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CCsApp)
afx_msg void OnAppAbout();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
const int WM_SERVER_ACCEPT=WM_USER +1; // used for WSAAsynSelect function
// cs.h ends here
CS.mak
////////////////////////////////////////////////////////////////////////
//File name : CS.mak
# Microsoft Developer Studio Generated NMAKE File, Format Version 40001
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=cs - Win32 Debug
!MESSAGE No configuration specified. Defaulting to cs - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "cs - Win32 Release" && "$(CFG)" != "cs - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "cs.mak" CFG="cs - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "cs - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "cs - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
RSC=rc.exe
CPP=cl.exe
MTL=mktyplib.exe
!IF "$(CFG)" == "cs - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\cs.exe"
CLEAN :
-@erase ".\Release\cs.exe"
-@erase ".\Release\cs.obj"
-@erase ".\Release\cs.pch"
-@erase ".\Release\StdAfx.obj"
-@erase ".\Release\MainFrm.obj"
-@erase ".\Release\csDoc.obj"
-@erase ".\Release\csView.obj"
-@erase ".\Release\cs.res"
-@erase ".\Release\resset.obj"
-@erase ".\Release\modelset.obj"
-@erase ".\Release\compset.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
"_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/cs.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/cs.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/cs.bsc"
BSC32_SBRS=
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/cs.pdb"\
/machine:I386 /out:"$(OUTDIR)/cs.exe"
LINK32_OBJS= \
"$(INTDIR)/cs.obj" \
"$(INTDIR)/StdAfx.obj" \
"$(INTDIR)/MainFrm.obj" \
"$(INTDIR)/csDoc.obj" \
"$(INTDIR)/csView.obj" \
"$(INTDIR)/resset.obj" \
"$(INTDIR)/modelset.obj" \
"$(INTDIR)/compset.obj" \
"$(INTDIR)/cs.res" \
"..\Msdev\Lib\Wsock32.lib"
"$(OUTDIR)\cs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "cs - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
ALL : "$(OUTDIR)\cs.exe"
CLEAN :
-@erase ".\Debug\cs.exe"
-@erase ".\Debug\cs.obj"
-@erase ".\Debug\cs.pch"
-@erase ".\Debug\StdAfx.obj"
-@erase ".\Debug\MainFrm.obj"
-@erase ".\Debug\csDoc.obj"
-@erase ".\Debug\csView.obj"
-@erase ".\Debug\cs.res"
-@erase ".\Debug\resset.obj"
-@erase ".\Debug\modelset.obj"
-@erase ".\Debug\compset.obj"
-@erase ".\Debug\cs.ilk"
-@erase ".\Debug\cs.pdb"
-@erase ".\Debug\vc40.pdb"
-@erase ".\Debug\vc40.idb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/cs.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
CPP_OBJS=.\Debug/
CPP_SBRS=
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/cs.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/cs.bsc"
BSC32_SBRS=
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/cs.pdb" /debug /machine:I386 /out:"$(OUTDIR)/cs.exe"
LINK32_OBJS= \
"$(INTDIR)/cs.obj" \
"$(INTDIR)/StdAfx.obj" \
"$(INTDIR)/MainFrm.obj" \
"$(INTDIR)/csDoc.obj" \
"$(INTDIR)/csView.obj" \
"$(INTDIR)/resset.obj" \
"$(INTDIR)/modelset.obj" \
"$(INTDIR)/compset.obj" \
"$(INTDIR)/cs.res" \
"..\Msdev\Lib\Wsock32.lib"
"$(OUTDIR)\cs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "cs - Win32 Release"
# Name "cs - Win32 Debug"
!IF "$(CFG)" == "cs - Win32 Release"
!ELSEIF "$(CFG)" == "cs - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\cs.cpp
DEP_CPP_CS_CP=\
".\cs.h"\
".\MainFrm.h"\
".\csDoc.h"\
".\csView.h"\
".\StdAfx.h"\
".\compset.h"\
".\modelset.h"\
".\resset.h"\
"$(INTDIR)\cs.obj" : $(SOURCE) $(DEP_CPP_CS_CP) "$(INTDIR)" "$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\StdAfx.cpp
DEP_CPP_STDAF=\
".\StdAfx.h"\
!IF "$(CFG)" == "cs - Win32 Release"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
"_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/cs.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c\
$(SOURCE) \
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\cs.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ELSEIF "$(CFG)" == "cs - Win32 Debug"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/cs.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\cs.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\MainFrm.cpp
DEP_CPP_MAINF=\
".\StdAfx.h"\
".\cs.h"\
".\MainFrm.h"\
"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\csDoc.cpp
DEP_CPP_CSDOC=\
".\StdAfx.h"\
".\cs.h"\
".\resset.h"\
".\modelset.h"\
".\compset.h"\
".\csDoc.h"\
"$(INTDIR)\csDoc.obj" : $(SOURCE) $(DEP_CPP_CSDOC) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\csView.cpp
DEP_CPP_CSVIE=\
".\StdAfx.h"\
".\cs.h"\
".\email1.h"\
".\regis1.h"\
".\result1.h"\
".\resset.h"\
".\modelset.h"\
".\model1.h"\
".\compset.h"\
".\Welcome.h"\
".\company2.h"\
".\csDoc.h"\
".\csView.h"\
"$(INTDIR)\csView.obj" : $(SOURCE) $(DEP_CPP_CSVIE) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\cs.rc
DEP_RSC_CS_RC=\
".\res\cs.ico"\
".\res\csDoc.ico"\
".\res\Toolbar.bmp"\
".\res\cs.rc2"\
"$(INTDIR)\cs.res" : $(SOURCE) $(DEP_RSC_CS_RC) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=\Msdev\Lib\Wsock32.lib
!IF "$(CFG)" == "cs - Win32 Release"
!ELSEIF "$(CFG)" == "cs - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\resset.cpp
DEP_CPP_RESSE=\
".\StdAfx.h"\
".\cs.h"\
".\resset.h"\
"$(INTDIR)\resset.obj" : $(SOURCE) $(DEP_CPP_RESSE) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\modelset.cpp
DEP_CPP_MODEL=\
".\StdAfx.h"\
".\cs.h"\
".\modelset.h"\
"$(INTDIR)\modelset.obj" : $(SOURCE) $(DEP_CPP_MODEL) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\compset.cpp
DEP_CPP_COMPS=\
".\StdAfx.h"\
".\cs.h"\
".\compset.h"\
"$(INTDIR)\compset.obj" : $(SOURCE) $(DEP_CPP_COMPS) "$(INTDIR)"\
"$(INTDIR)\cs.pch"
# End Source File
# End Target
# End Project
################################################################################
//CS.mak ends here
////////////////////
// NOTE :
/*
1) Make a directory called DBF and copy the following files in to it
i> COMPANY.DBF
ii>MODEL.DBF
2) Copy all the .GIF files in to the directory containing the project
*/
Please e-mail us your comments , feedback or any sugestions on the project.
To learn more about the latest in Internet Technologies, move back to the Vijay Mukhi's Technology Cornucopia Page.
Vijay Mukhi's Computer Institute
VMCI, B-13, Everest Building, Tardeo, Mumbai 400 034, India
e-mail : vmukhi@giasbm01.vsnl.net.in
http://www.vijaymukhi.com
Tel : 91-22-496 4335 /6/7/9
Fax : 91-22-307 28 59