Click here to Skip to main content
15,913,944 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: images Pin
cmk19-Jul-04 23:22
cmk19-Jul-04 23:22 
GeneralExperts in Embedded Visual C++, Visual C++ n PDA programming come in Pin
Anonymous19-Jul-04 21:04
Anonymous19-Jul-04 21:04 
GeneralCode for my Class CListenSocket: ListenSocket.h Pin
Anonymous19-Jul-04 21:05
Anonymous19-Jul-04 21:05 
GeneralCode for my Class CListenSocket: ListenSocket.cpp Pin
Anonymous19-Jul-04 21:07
Anonymous19-Jul-04 21:07 
GeneralCode for my Class CLinkSocket: LinkSocket.h Pin
Anonymous19-Jul-04 21:10
Anonymous19-Jul-04 21:10 
GeneralCode for my Class CLinkSocket: LinkSocket.cpp Pin
Anonymous19-Jul-04 21:12
Anonymous19-Jul-04 21:12 
GeneralCode for my Class ServerDlg: ServerDlg.h Pin
Anonymous19-Jul-04 21:18
Anonymous19-Jul-04 21:18 
GeneralCode for my Class ServerDlg: ServerDlg.Cpp (Not yet completed) Pin
Anonymous19-Jul-04 21:20
Anonymous19-Jul-04 21:20 
// ServerDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Server.h"
#include "ServerDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CServerDlg dialog

CServerDlg::CServerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CServerDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CServerDlg)
m_sStatus = _T("");
m_sPort = 0;

//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CServerDlg:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
//{{AFX_DATA_MAP(CServerDlg)
DDX_Control(pDX, IDC_cmdStop, m_bStop);
DDX_Control(pDX, IDC_cmdListen, m_bListen);
DDX_Control(pDX, IDC_cmdDisconnect, m_bDisconnect);
DDX_Text(pDX, IDC_Status, m_sStatus);
DDX_Text(pDX, IDC_Port, m_sPort);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CServerDlg, CDialog)
//{{AFX_MSG_MAP(CServerDlg)
ON_WM_HELPINFO()
ON_BN_CLICKED(IDC_cmdDisconnect, OncmdDisconnect)
ON_BN_CLICKED(IDC_cmdListen, OncmdListen)
ON_BN_CLICKED(IDC_cmdStop, OncmdStop)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CServerDlg message handlers

BOOL CServerDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

CenterWindow(GetDesktopWindow()); // center to the hpc screen

State = 0;
GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> EnableWindow(FALSE);
GetDlgItem(IDC_cmdListen) -> ShowWindow(TRUE);

screen.Empty();

SPacket.packetno = 0;

return TRUE; // return TRUE unless you set the focus to a control
}


void CServerDlg::OnHelpInfo()
{
MessageBox(_T("Help"));
}


//Listen Function

void CServerDlg::OncmdListen()
{

UpdateData(TRUE);

lSocket = new CListenSocket(this);

int Port;
Port = m_sPort;

//char* txtPort;
//int i = m_sPort;
//_itoa(i, txtPort, 10);

//MessageBox(txtPort,NULL,MB_OK);

//If cannot create port
if (!lSocket->Create(Port))
{
MessageBox(_T("No port Created!"), NULL, MB_OK);
return;
}
else
{
}

//If cannot listen
if (!lSocket->Listen())
{
MessageBox(_T("Cannot listen"), NULL, MB_OK);
return;
}
else
{
MessageBox(_T("Listening"), NULL, MB_OK);

GetDlgItem(IDC_cmdListen) -> EnableWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> EnableWindow(TRUE);

State = 1;
}
}

//Accept Function
void CServerDlg::pAccept(void)
{

eSocket = new CLinkSocket(this);

if (lSocket->Accept(*eSocket))
{
State = 2;
MessageBox(_T("Connection Accepted!"), NULL, MB_OK);
GetDlgItem(IDC_cmdStop) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(TRUE);
}
else
{
MessageBox(_T("Connection not Accepted!"), NULL, MB_OK);
delete eSocket;
}

}


// Read Function
void CServerDlg::Read(CLinkSocket* eSocket)
{
CString strcommand;
int pRead = eSocket->Receive(&RPacket, sizeof(Packet));

if (pRead > 0)
{
if (RPacket.cstatus == 0)
{
OncmdDisconnect();
}
else
{
//command = mbstowcs(buffer, RPacket.Message, 100)
}
}
}

void CServerDlg::OncmdStop()
{

GetDlgItem(IDC_cmdListen) -> EnableWindow(TRUE);
GetDlgItem(IDC_cmdDisconnect) -> EnableWindow(FALSE);

SPacket.cstatus = 0;

lSocket->Close();
delete lSocket;

GetDlgItem(IDC_cmdListen) -> EnableWindow(TRUE);
GetDlgItem(IDC_cmdStop)-> EnableWindow(FALSE);

State = 0;

}


// Disconnect Function

void CServerDlg::OncmdDisconnect()
{

SPacket.cstatus = 0;

eSocket->Close();
lSocket->Close();
delete eSocket;
delete lSocket;

GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> ShowWindow(TRUE);

State = 1;
}
GeneralRe: Experts in Embedded Visual C++, Visual C++ n PDA programming come in Pin
buaya_hunter21-Jul-04 16:56
buaya_hunter21-Jul-04 16:56 
GeneralMemory Leaks in SqlCe Pin
rmkmani17-Jul-04 2:06
rmkmani17-Jul-04 2:06 
QuestionOwner Drawn ListBox in CE??? Pin
Chris Reiff14-Jul-04 7:51
Chris Reiff14-Jul-04 7:51 
AnswerRe: Owner Drawn ListBox in CE??? Pin
João Paulo Figueira14-Jul-04 12:05
professionalJoão Paulo Figueira14-Jul-04 12:05 
GeneralRe: Owner Drawn ListBox in CE??? Pin
Chris Reiff16-Jul-04 7:18
Chris Reiff16-Jul-04 7:18 
Generalseeking mp3 component for pocket pc Pin
mad_sci14-Jul-04 4:09
mad_sci14-Jul-04 4:09 
GeneralQuestion about cab files and inf files Pin
Cedric Moonen13-Jul-04 1:48
Cedric Moonen13-Jul-04 1:48 
GeneralRe: Question about cab files and inf files Pin
Cedric Moonen13-Jul-04 2:19
Cedric Moonen13-Jul-04 2:19 
QuestionHow to download Email's (attachments) from mailserver mailbox. Pin
nareshchhonker12-Jul-04 20:18
nareshchhonker12-Jul-04 20:18 
Generalstoring blob data in sql ce Pin
rmkmani12-Jul-04 3:52
rmkmani12-Jul-04 3:52 
GeneralRe: storing blob data in sql ce Pin
João Paulo Figueira12-Jul-04 7:42
professionalJoão Paulo Figueira12-Jul-04 7:42 
GeneralA serious bug of list view in compact framework Pin
ting66812-Jul-04 0:14
ting66812-Jul-04 0:14 
GeneralDataGrid for eVC++ 4.0 Pin
Hadi Rezaee11-Jul-04 19:08
Hadi Rezaee11-Jul-04 19:08 
GeneralRe: DataGrid for eVC++ 4.0 Pin
João Paulo Figueira12-Jul-04 7:52
professionalJoão Paulo Figueira12-Jul-04 7:52 
GeneralRe: DataGrid for eVC++ 4.0 Pin
Hadi Rezaee12-Jul-04 10:30
Hadi Rezaee12-Jul-04 10:30 
GeneralTHis problem happen again and again Pin
ting66811-Jul-04 16:04
ting66811-Jul-04 16:04 
QuestionDatagrid : Bitmap in Cell ?? Pin
thilec10-Jul-04 22:45
thilec10-Jul-04 22:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.