Sunday, May 30, 2010

SERIAL EX SIGAL

class CSerialEx : public CSerial
{
// Construction
public:
CSerialEx();
virtual ~CSerialEx();

// Operations
public:
// Open the serial communications for a particular COM port. You
// need to use the full devicename (i.e. "COM1") to open the port.
virtual LONG Open (LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fStartListener = false);

// Close the serial port.
virtual LONG Close (void);

// Start the listener thread
virtual LONG StartListener (void);

// Stop the listener thread. Because the other thread might be
// busy processing data it might take a while, so you can specify
// a time-out.
virtual LONG StopListener (DWORD dwTimeout = INFINITE);

protected:
// Each opened COM-port uses its own specific thread, which will
// wait for one of the events to happen. When an event happens,
// then the client window is send a message informing about the
// event.
static DWORD WINAPI ThreadProc (LPVOID lpArg);
DWORD ThreadProc (void);

// Event handler
virtual void OnEvent (EEvent eEvent, EError eError) = 0;

protected:
// The WaitEvent method is being used by this class internally
// and shouldn't be used by client applications. Client
// application should monior the messages.
using CSerial::WaitEvent;

// The event-type is send in the WPARAM of the message and
// the GetEventType method returns the wrong data, so we'll
// hide this method for client applications to avoid problems.
using CSerial::GetEventType;
using CSerial::GetError;

protected:
// Internal attributes
bool m_fStopping;
HANDLE m_hThread;

#ifndef SERIAL_NO_OVERLAPPED
// Handle for overlapped operations in worker-thread
HANDLE m_hevtOverlappedWorkerThread;
#endif
};

#endif // __SERIAL_EX_H

Friday, May 28, 2010

SERIAL WIND

class CSerialWnd : public CSerialEx
{
// Construction
public:
CSerialWnd();
virtual ~CSerialWnd();

// Operations
public:
// Open the serial communications for a particular COM port. You
// need to use the full devicename (i.e. "COM1") to open the port.
virtual LONG Open (LPCTSTR lpszDevice, HWND hwndDest, UINT nComMsg=WM_NULL, LPARAM lParam=0, DWORD dwInQueue = 0, DWORD dwOutQueue = 0);

// Close the serial port.
virtual LONG Close (void);

protected:
// Event handler that is called when
virtual void OnEvent (EEvent eEvent, EError eError);

public:
// Default Serial notification message
static const UINT mg_nDefaultComMsg;

protected:
// Internal attributes
HWND m_hwndDest;
UINT m_nComMsg;
LONG m_lParam;
};

#endif // __SERIAL_WND_H

SERIAL MFC

#ifndef __SERIAL_EX_H
#define __SERIAL_EX_H


//////////////////////////////////////////////////////////////////////
// Include CSerial base class

#include "Serial.h"


//////////////////////////////////////////////////////////////////////
//
// CSerialEx - Win32 message-based wrapper for serial communications
//
// A lot of MS-Windows GUI based programs use a central message
// loop, so the application cannot block to wait for objects. This
// make serial communication difficult, because it isn't event
// driven using a message queue. This class makes the CSerial based
// classes suitable for use with such a messagequeue. Whenever
// an event occurs on the serial port, a user-defined message will
// be sent to a user-defined window. It can then use the standard
// message dispatching to handle the event.
//
// Pros:
// -----
// - Easy to use
// - Fully ANSI and Unicode aware
// - Integrates easily in GUI applications and is intuitive to
// use for GUI application programmers
//
// Cons:
// -----
// - Uses a thread for each COM-port, which has been opened.
// - More overhead, due to thread switching and message queues.
// - Requires a window, but that's probably why you're using
// this class.
//
// Copyright (C) 1999-2003 Ramon de Klein
// (Ramon.de.Klein@ict.nl)

class CSerialEx : public CSerial
{
// Construction
public:
CSerialEx();
virtual ~CSerialEx();

// Operations
public:
// Open the serial communications for a particular COM port. You
// need to use the full devicename (i.e. "COM1") to open the port.
virtual LONG Open (LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fStartListener = false);

// Close the serial port.
virtual LONG Close (void);

// Start the listener thread
virtual LONG StartListener (void);

// Stop the listener thread. Because the other thread might be
// busy processing data it might take a while, so you can specify
// a time-out.
virtual LONG StopListener (DWORD dwTimeout = INFINITE);

protected:
// Each opened COM-port uses its own specific thread, which will
// wait for one of the events to happen. When an event happens,
// then the client window is send a message informing about the
// event.
static DWORD WINAPI ThreadProc (LPVOID lpArg);
DWORD ThreadProc (void);

// Event handler
virtual void OnEvent (EEvent eEvent, EError eError) = 0;

protected:
// The WaitEvent method is being used by this class internally
// and shouldn't be used by client applications. Client
// application should monior the messages.
using CSerial::WaitEvent;

// The event-type is send in the WPARAM of the message and
// the GetEventType method returns the wrong data, so we'll
// hide this method for client applications to avoid problems.
using CSerial::GetEventType;
using CSerial::GetError;

protected:
// Internal attributes
bool m_fStopping;
HANDLE m_hThread;

#ifndef SERIAL_NO_OVERLAPPED
// Handle for overlapped operations in worker-thread
HANDLE m_hevtOverlappedWorkerThread;
#endif
};

#endif // __SERIAL_EX_H

Asynchronous I/O

bool fQuit = false;
while (!fQuit)
{
// Wait for a communication event or windows message

switch (::MsgWaitForMultipleObjects(1,&hevtCommEvent,FALSE,INFINITE,QS_ALLEVENTS))
{
case WAIT_OBJECT_0:
{
// There is a serial communication event, handle it...

HandleSerialEvent();
}
break;

case WAIT_OBJECT_0+1:
{
// There is a windows message, handle it...

MSG msg;
while (::PeekMessage(&msg,0,0,0,PM_REMOVE))
{
// Abort on a WM_QUIT message

if (msg.message == WM_QUIT) { fQuit = true; break; }

// Translate and dispatch the message

::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
break;

default:
{
// Error handling...

}
break;
}
}

SERIAL PORT COMMUNICATION(USB)

#define STRICT
#include

#include

#include "Serial.h"


int WINAPI _tWinMain
(
HINSTANCE /*hInst*/,
HINSTANCE /*hInstPrev*/,
LPTSTR /*lptszCmdLine*/,
int /*nCmdShow*/
)
{
CSerial serial;

// Attempt to open the serial port (COM1)

serial.Open(_T("COM1"));

// Setup the serial port (9600,N81) using hardware handshaking

serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
serial.SetupHandshaking(CSerial::EHandshakeHardware);

// The serial port is now ready and we can send/receive data. If

// the following call blocks, then the other side doesn't support

// hardware handshaking.

serial.Write("Hello world");

// Close the port again

serial.Close();
return 0;
}

Thursday, May 27, 2010

Invitation to join Amulyam-Free Prepaid Mobile Recharge and Movie Tickets

Happy to invite you to join Amulyam,that gives considerable amount of free prepaid mobile recharge and
free movie tickets immediately for doing what you normally do online:creating accounts on
social networking websites, photo sharing websites,video sharing websites,buying train tickets..etc.

Create your amulyam account and refer your friends to get more prepaid mobile recharge and movie tickets for free.

You can copy and paste below link to the address bar of your browser
or Click Here to create your account on amulyam.


http://www.amulyam.in/register.do?id=ad960254-30ef-4589-a149-72bc20dc71fe&sid=1


Sibichakkaravarthy

Tuesday, May 18, 2010

.HTACCESS


.HTACCESS

# my first .htaccess stuff is here
# this is a comment line.
# custom 404 file
# url redirection
# url rewrite
#sibitherocker.ning.com/500.html

ErrorDocument 404 /pagenotfound.html
ErrorDocument 500 500.html

# Redirection

Redirect /oldpage.html /newfileishere.html

Redirect / http://sibitherocker.ning.com

# Rewrite
Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*)\.html$ $1.php [NC]

# http://sibitherocker.ning.com/display.php?month=jan&year=2010&page=2

# http://sibitherocker.ning.com/display-jan-2010-page-2

RewriteRule ^/display-([a-z]+)-([0-9]+)-page-([0-9]+) http://sibitherocker.ning.com/display.php?month=$1&year=$2&page=$3