Você está na página 1de 84

I hereby declare that I have read this thesis and in my

opinion this thesis is sufficient in terms of scope and quality for the
award of the degree of Bachelor Of Engineering
(Electrical-Electronics).

Signature :
Name : Dr. Musa Bin Mohd Mokji
Date : 20 May 2011
i

A TOUCH SCREEN MONITOR APPLICATION FOR CASHIER

LIEW HON CHIN

A thesis submitted in fulfilment of the


requirements for the award of the degree of
Bachelor of Engineering (Electrical-Electronics)

Faculty of Electrical Engineering


Universiti Teknologi Malaysia

May 2011
ii

I declare that this thesis entitled A Touch Screen Monitor Application for Cashier
is the result of my own research except as cited in the references. The thesis has not
been accepted for any degree and is not concurrently submitted in candidature of any
other degree.

Signature : .

Name : LIEW HON CHIN

Date : 20 May 2011


iii

Specially dedicated to my family, supervisor and friends who have been there for me
and inspired me along the way.
iv

ACKNOWLEDGEMENT

First and foremost, I would like to express my heartily gratitude to my


supervisor, Dr. Musa Bin Mohd Mokji for the guidance and enthusiasm given
throughout the progress of this project.

Next, my appreciation goes to my family who has been so tolerant and


supports me all these years. Thanks for their continuing love, emotional support and
encouragement that they had given to me.

I would also like to thank my Multimedia Lecturer, Dr. Usman Ullah Sheikh
for the guidance and helps in this project.

Last but not least, I would like to extend my appreciation to all those who
have directly or indirectly played a part in the completion and the success of this
thesis.
v

ABSTRACT

This project is reporting a touch screen monitor application for cashier, which
is based on Windows Programming of touch screen via Microsoft Visual Basic and
Windows SDK. The purpose of this project is to program a touch screen monitor
which can provide the sales, management and stock control information for business
that can be used for cashier. At the same time, this project is to improve the cashier
system by using a touch screen monitor instead of keyboard and mouse to interface
with computer. As a result, the sales can be performed faster and effectively. To
program the touch screen monitor, Windows SDK related to touch screen is first
installed in the computer. Some of the operations can be programmed similar to
mouse click operations. These include gestures such as tap, double tap and press and
hold gestures as these gestures are equivalent to left click, left double click and right
click respectively of the mouse. In this project, a webcam is interfaced to the
program to capture image for recognition of the products. This is very useful for
cashier since the information of the products will be displayed on the screen
automatically once the products are being recognized. Finally, it can be concluded
that the sales can be performed faster and smoothly by applying the multi-touch
gestures and touch screen monitor for cashier.
vi

ABSTRAK

Projek ini melaporkan aplikasi monitor skrin sentuh untuk juruwang yang
berkenaan dengan tetingkap pengaturcaraan skrin sentuh dengan menggunakan
Microsoft Visual Basic dan Windows SDK. Tujuan projek ini adalah untuk
memprogramkan sebuah monitor skrin sentuh yang boleh digunakan oleh juruwang
untuk memudahkankan jualan, serta menyediakan pengurusan dan maklumat stok
kawalan dalam perniagaan. Pada masa yang sama, projek ini adalah untuk
memperbaiki sistem juruwang dengan menggunakan monitor skrin sentuh, tanpa
menggunakan papan kekunci dan tetikus untuk berinteraksi dengan komputer.
Dengan itu, jualan boleh dilakukan dengan lebih cepat dan berkesan. Untuk
memprogramkan monitor skrin sentuh, Windows SDK yang berkaitan dengan skrin
sentuh akan dipasangkan pada komputer terlebih dahulu. Beberapa operasi yang
setara dengan operasi klik tetikus boleh diprogramkan. Ini termasuklah gerakan
seperti sentuh, sentuh ganda, sentuh dan tahan gerakan yang setara dengan klik kiri,
klik kiri ganda dan klik kanan tetikus masing-masing. Dalam projek ini, sebuah
kamera web akan dihubungkan kepada program untuk menangkapkan gambar dan
pengenalan produk. Ini adalah amat berguna untuk juruwang kerana maklumat
produk akan dipaparkan pada paparan secara automatik selepas produk tersebut
dikenali. Akhirnya, dapat disimpulkan bahawa jualan boleh dilakukan dengan lebih
cepat dan lancar setelah menerapkan gerakan pelbagai sentuh dan monitor skrin
sentuh untuk juruwang.
vii

TABLE OF CONTENTS

CHAPTER TITLE PAGE

DECLARATION ii
DEDICATION iii
ACKNOWLEDGEMENT iv
ABSTRACT v
ABSTRAK vi
TABLE OF CONTENTS vii
LIST OF TABLES x
LIST OF FIGURES xi
LIST OF ABBREVIATIONS xiii
LIST OF APPENDICES xiv

1 INTRODUCTION 1
1.1 Background of touch screen 1
1.2 Problem statement 2
1.3 Objectives 3
1.4 Scope of the project 3
1.5 Outline of Thesis 4
1.6 Summary of works 4

2 LITERATURE REVIEW 6
2.1 Introduction 6
2.2 History of touch screen technology 6
2.3 Construction of touch screen 7
2.3.1 Touch Sensor 8
viii

2.3.2 Controller 8
2.3.3 Software Driver 8
2.4 Touch screen technology 9
2.4.1 Resistive touch screen 9
2.4.2 Capacitive touch screen 10
2.4.3 Surface Acoustic Wave 11
2.4.4 Infrared 12
2.5 Advantages and disadvantages of touch screen 12
2.6 Touch screen applications 13
2.6.1 Cashier system 13
2.6.2 Public information displays 13
2.6.3 Customer self-services 14
2.6.4 Other applications 14
2.7 Windows API 15
2.8 Graphical User Interface (GUI) 16
2.9 Event-driven Programming 16
2.10 Microsoft Windows SDK 17
2.11 Architectural overview of touch 18

3 METHODOLOGY 20
3.1 Hardware and software 20
3.1.1 Touch screen monitor 20
3.2 Flow process 22
3.3 Graphical User Interface 24
3.4 Windows Programming 25
3.4.1 Multi-touch Gestures 25
3.4.2 Plot histogram of the image 29
3.4.3 Create database using Microsoft Access 30
3.4.4 Webcam interface 32
3.4.5 Calculator 33
3.4.6 Cashier or manager login 36
3.4.7 Change username or password 37
ix

4 RESULT AND DISCUSSION 39


4.1 Introduction 39
4.2 Touch capabilities 39
4.3 Login Menu 42
4.4 Main Menu 43
4.5 Cashier Login Menu 44
4.6 Sale 45
4.7 Plot histogram 47
4.8 Database Menu 48
4.9 Item Details Menu 50
4.10 Username and password setting 51
4.11 Multimedia 53
4.12 Applications 56

5 CONCLUSION AND FUTURE WORK 59


5.1 Conclusion 59
5.2 Future Works 60

REFERENCES 61

APPENDICES A B 64
x

LIST OF TABLES

TABLE NO. TITLE PAGE

2.1 Name of the each label in diagram of Figure 2.2 10


2.2 Advantages and disadvantages of touch screen 12
3.1 Specifications for Acer T231H 21
3.2 Various identifiers for gestures 27
4.1 List of touch capabilities 40
4.2 Equivalent message and used of the gestures 41
xi

LIST OF FIGURES

FIGURE NO. TITLE PAGE

1.1 Gantt Chart of the project schedule for semester 1 5


1.2 Gantt Chart of the project schedule for semester 2 5
2.1 A touch sensor, controller and software drive 7
2.2 Construction of resistive touch screen 10
2.3 Construction of Surface Acoustic Wave 11
2.4 Some applications of touch screen a) Cashier System
b) ATM Machine c) Mobile Phone 14
2.5 The Event-Driven Programming Paradigm 16
2.6 Processing messages for Windows touch input and gestures 18
3.1 Acer 23T231H Touch Screen Monitor 21
3.2 Process flow of the project 22
3.3 Graphical User Interface (GUI) 24
3.4 Steps for using multi-touch gestures 25
3.5 Flowchart of programming multi-touch gestures 28
3.6 Process of plotting histogram of an image 29
3.7 Source code of computing the histogram of colors 30
3.8 Source code of connecting to Access database 31
3.9 Webcam interface using Graphics Device Interface (GDI) 32
3.10 Webcam capture using the GDI and The DC 33
3.11 Flowchart of programming calculator 35
3.12 Flowchart of the login process 36
3.13 Flowchart of changing the username or password 38
4.1 Login Menu 42
4.2 Main Menu 43
xii

4.3 Cashier Registration Menu 44


4.4 Sale Menu 45
4.5 Receipt 46
4.6 Safety Window 47
4.7 Plot Histogram Menu 48
4.8 Database Menu 49
4.9 Item Details Menu 50
4.10 Image Preview 51
4.11 Change Manager Username Menu 52
4.12 Change Manager Password Menu 52
4.13 Change Cashier Password Menu 53
4.14 Play Sound Menu 54
4.15 Play Video Menu 55
4.16 Slide Show Menu 55
4.17 Calculator 56
4.18 Record Notes Menu 57
4.19 Edit Image Menu 58
4.20 Web Browser Menu 58
B.1 Access Database 68
xiii

LIST OF ABBREVIATIONS

ATM - Automatic Teller Machine


GUI - Graphical User Interface
SDK - Software Development Kits
API - Application Programming Interface
CRT - Cathode Ray Tube
ITO - Indium Tin Oxide
LED - Light-emitting Diode
VGA - Video Graphic Array
DVI - Digital Visual Interface
HDMI - High-Definiton Multimedia Interface
OOP - Object-oriented Programming
GDI - Graphic Device Interface
DC - Device Context
ADO - Active Data Object
OLE - Object Linking and Embedding
SQL - Structured Query Language
xiv

LIST OF APPENDICES

APPENDIX TITLE PAGE

A SOURCE CODE OF MULTI-TOUCH GESTURES 64


B ACCESS DATABASE 68
1

CHAPTER 1

INTRODUCTION

1.1 Background of Touch Screen

In recent years, touch screen technology become increasingly popular with


the advent of computer systems and mobile phones. A touch screen is an electronic
visual display that can detect the location of a touch within the display area by using
finger or stylus and is the most user friendly interface [1]. Touch screen monitor
allows a user to interact with a computer by touching pictures, icons or words on the
screen.

Touch screen are used in a wide variety of applications such as cashier system,
information kiosks, Automatic Teller Machine (ATM), and system designed to help
individuals who have difficulty in manipulating a mouse or keyboard. Touch screen
technology can also be used as an alternative user interface with application that
usually requires a mouse. Some applications are designed specifically for touch
screen technology, frequently having larger icons than typical computer applications.
2

1.2 Problem Statement

Nowadays, there are a lot of problems faced by the cashiers in shopping malls,
supermarkets, restaurants and many other places. The main problem faced by
cashiers is they need external keyboard and mouse to interface with the computer. It
causes the space of the table become limited. The sale process is slow because of
many windows need to go through for certain functions. Besides that, the programs
only have few basic operations and less graphic interfaces.

With the rise of touch screen technology, touch screen monitors are very
useful for the cashiers to ensure that the sales can be performed faster and effectively.
In this project, a touch screen monitor which can be used for cashier is programmed.
By using the touch screen monitor, no external keyboard and mouse are required.
This is because touch screen monitor can acts as both an input and output device.
User can communicate with the computer effectively without using any external
keyboard and mouse. Thus, the space is reduced. On the other hand, touch screen
monitor provides shortcut and multi-touch functions, so that the users no need to go
through many windows for certain functions. Therefore, the sale process can be
performed faster.
3

1.3 Objectives

The objectives of this project are:

i. To program a touch screen monitor which can provide sales, management


and stock control information for business that can be used for cashier.
ii. To apply the knowledge of Microsoft Visual Basic, Graphical User Interface
(GUI), and Windows SDK to program the touch screen monitor.
iii. To interface with a webcam to capture image and plot histogram of the image.

1.4 Scope of The Project

In order to achieve the objectives of this project, there are several scope had
been outlined. The scope of this project is mainly focus on the graphical user
interface (GUI) and Windows programming of the touch screen. In this project,
Microsoft Visual Basic 2010 and Windows SDK are used to program a touch screen
monitor which support multi-touch functions. Besides that, a lot of graphic
interfaces such as plotting histogram, multimedia, edit database, username and
password settings and some other applications other than calculation of price will be
developed. Last but not least, a webcam is interfaced to the program to capture
image of the product and plot the histogram of the image.
4

1.5 Outline Of Thesis

This thesis consists of five chapters. In the first chapter, introduction,


problem statement, objective, scope of this project as well as summary of work are
discussed. While in Chapter 2, it will discuss more on literature reviews and project
background. The history of touch screen, construction of touch screen, touch screen
technology, touch screen advantages and disadvantages, touch screen applications,
Windows API, Graphical User Interface, Event-driven Programming, Windows SDK
and architectural overview of touch will be discussed.

In Chapter 3, the discussion is on the project methodology. Process flow of


the project, hardware and software used, GUI and the steps to program each window
will be discussed. Then, the result and discussion will be presented in Chapter 4.
Last but not least, Chapter 5 discusses the conclusion and future work.

1.6 Summary of Works

Gantt charts as shown in Figure 1.1 and Figure 1.2 show the detail of the
works of the project that have been implemented in the first and second semester.
5

Week 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Activities
Research on
FYP topic
Literature
review
Program for
mouse click
Presentation
Report
writing
Figure 1.1 Gantt Chart of the project schedule for semester 1

Week 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Activities
Literature
review
Program for
mouse click
Program for
multi-touch
Interface
with
webcam
Presentation
Report
writing
Figure 1.2 Gantt Chart of the project schedule for semester 2
6

CHAPTER 2

LITERATURE REVIEW AND PROJECT BACKGROUND

2.1 Introduction

This chapter includes the study of the history of touch screen, construction of
touch screen, touch screen technology, touch screen advantages and disadvantages,
touch screen applications, Windows API, Graphical User Interface, event-driven
programming and Windows SDK.

2.2 History of Touch Screen Technology

The history of touch screen technology begin in 1971 when the first touch
sensor called the Elograph was invented by Doctor Sam Hurst while he was an
instructor at the University of Kentucky [2]. The touch sensor developed was not
transparent like the modern touch screen. In 1972, Hurst patented his sensor and
used it as the main point of a new business called Elographics [2].
7

In 1974, the first touch screen incorporate a transparent surface was


developed by Sam Hurst and Elographics [2]. In 1977, Elographics developed a
five-wire resistive technology, which is the most popular touch screen technology in
use today [2]. As a conclusion, Dr. Sam Hurst played an important role in the
development of touch technologies. He not only invented the first touch sensor, but
also the first touch screen.

2.3 Construction of Touch Screen

Figure 2.1 A touch sensor, controller and software drive

A basic touch screen has three main components, which are a touch sensor, a
controller, and a software driver as shown in Figure 2.1. The touch screen is an input
device, so it needs to be combined with a computer and a display or another device to
make a complete touch input system.
8

2.3.1 Touch Sensor

A touch sensor is a clear glass panel with a touch responsive surface [3]. To
ensure the responsive area of the panel covers the viewable area of the video screen,
the touch sensor is placed over a display screen. The sensor usually has an electrical
current flow through it. When touching the screen, it causes a voltage change which
is used to determine the location of the touch on the screen. The touch screen panel
registers touch events and passes the signals to the controller.

2.3.2 Controller

A small computer card that connects between the touch sensor and the
computer is called controller. A controller takes information from the touch sensor
and translates it into information that can be understood by computer. The controller
is usually installed inside the monitor for integrated monitors and determines the type
of interface needed on the computer. Integrated touch monitors will have an extra
cable connection on the back for the touch screen [3].

2.3.3 Software Driver

The driver is a software update for the computer system that allows the touch
screen to work together with a computer. When a user touches the screen, touch
event is generated. Software driver will tell the computers operating system how to
interpret the touch event information that is sent from the controller. The software
driver translates the touch event into the mouse event. Most of the touch screen
9

drivers nowadays are a mouse-emulation type driver [3]. This means touching the
screen is the equivalent as clicking your mouse at the same location on the screen.
The advantages of mouse-emulation are it allows the touch screen to work with
existing software and allows new applications to be developed without the need for
touch screen specific programming.

2.4 Touch Screen Technology

There are various types of touch screen technologies such as resistive,


capacitive, surface acoustic wave and infrared. However, resistive and capacitive
touch screen are types of touch screen that are widely used nowadays.

2.4.1 Resistive Touch Screen

Resistive touch screen is a type of touch screen that can be touched by both
finger and stylus. A resistive touch screen consists of normal glass panel that is
covered with a conductive and a resistive metallic layer [4]. When the top layer is
pressed by a finger or stylus, the two metallic layers become connected and current flow.
The change in the electrical current is registered as a touch event and sent to the
controller for processing. The existence of current in a horizontal and vertical line
gives the position (x and y coordinates) of the touch. Once the coordinates are
known, a driver translates the touch event into something that the operating system
can understand, such as a computer mouse driver translates a mouses movements
into a click. The construction of the resistive touch screen is shown in Figure 2.2 and
the name of each label is shown in Table 2.1.
10

Figure 2.2 Construction of resistive touch screen

Table 2.1 Name of the each label in diagram of Figure 2.2


Label Name
1 Scratch resident coating
2 Conductive layer
3 Separators
4 Resistive layers
5 Glass Panel
6 CRT

2.4.2 Capacitive Touch Screen

Capacitive touch screen is a type of touch screen that is only sensitive to the
touch of finger. A capacitive touch screen panel consists of an insulator such as
glass, coated with a transparent conductor such as Indium Tin Oxide (ITO) [1].
When a user touches the screen with his or her finger, some of the charge is
transferred to the user, thus allowing the computer to recognize the touch.
11

One of the advantages of the capacitive touch screen over the resistive touch
screen is that it can transmits almost 90 percent of the light from the monitor,
whereas the resistive touch screen can only transmits about 75 percent [5]. Thus,
capacitive touch screen has much clearer picture than the resistive touch screen.

2.4.3 Surface Acoustic Wave

Another type of touch screen technology is surface acoustic wave, which is


one of the most advanced touch screen types. It consists of transducer and reflector,
which is shown in Figure 2.3. Transducer is used to send the wave across a clear
glass panel while reflector reflects an electrical signal sent from one transducer to
another. When a user touches the screen with his or her finger, the waves are
absorbed, causing a touch event to be detected at that point [3].

Some advantages of surface acoustic wave are high touch resolution and
highest image clarity. Since the wave setup has no metallic layers on the screen, it
can transmit 100 percent of the light and the image is perfectly clear. Therefore,
surface acoustic wave is the best for displaying detailed graphics [6].

Figure 2.3 Construction of Surface Acoustic Wave


12

2.4.4 Infrared

Infrared touch screen technology uses a small frame around the display with
LED and photo receptors hidden behind an infrared transparent bezel [7]. The
controller pulses the LED to create LED beams. These LED beams cross each other
in horizontal and vertical patterns to help the sensors choose the exact location of the
touch. The main advantage of Infrared touch screen is that the touch can be activated
by anything including finger, gloved hand or stylus. This type of touch screen is
normally used in outdoor applications which cannot rely on a conductor, such as a
bare finger to activate the touch screen [1].

2.5 Advantages and Disadvantages of Touch Screen

Table 2.2 Advantages and disadvantages of touch screen


Advantages Disadvantages
Save space as no external keyboard and Hard to select small items.
mouse are required.
Touch screen devices have fewer buttons. Some reduction in image brightness
may occur.
Touch screen monitors can reduce the size Some touch screen would cause users
of a computer system. to feel a little electric shocks if they
touch the screen with their wet
fingers.
Protected from hazards such as electrical -
surges, temperature variations, physical and
climatic changes.
Easy to use as the user only touches what -
he or she sees on the display screen
13

2.6 Touch Screen Applications

Touch screen system are being used in a wide variety of applications such as
cashier system, public information displays, customer self-services and so on. This
is due to the touch screen is one of the easiest computer interfaces to use.

2.6.1 Cashier System

In shopping mall, supermarket, restaurant or retail, cashiers need the fast


cashier system to do sales. Touch screen can help the cashiers to perform the sales
faster and smoothly. Since the touch screen systems is easy to use, cashiers can get
the work done faster and training time for new cashiers can be reduced. By using
touch screen, no external keyboard and mouse are required. Because input is done
right on the display screen, valuable counter space can be saved.

2.6.2 Public Information Displays

Information kiosks, tourism displays, and other electronic displays are used
by a lot of people that have a little or no computing experience. The touch screen
interface is easier to use compared to other input devices. A touch screen can help to
get the information easily by allowing users to simply touch the display screen [8].
14

2.6.3 Customer self-services

Self-service touch screen terminals can be used to improve customer service


at transportation hubs, fast service restaurants, and so on. Customers can quickly put
their own orders or check themselves in or out. Thus, save their time and decrease
the wait times for other customers. Examples of self-services stations are Automatic
Teller Machine (ATM) and airline e-ticket terminals [8].

2.6.4 Other Applications

Other applications of touch screen include automobile industry, student


registration systems, industrial and medical instrumentation, and gaming system.

(a) (b) (c)


Figure 2.4 Some applications of touch screen a) Cashier System b) ATM
Machine c) Mobile Phone
15

2.7 Windows API

API stands for Application Programming Interface. The Microsoft Windows


application programming interface (API) provides services used by all Windows-
based applications. It serves as a software interface to be used by other programs.
An API is actually the fundamental level higher-level programming. With Windows
API, software designers can provide their application with a graphical user interface,
access system resources such as memory and devices, display graphics, and integrate
video, audio, networking or security [9].

Windows API handles everything of a program. Naturally, it encompasses


aforementioned things such as drawing on the monitor, printer interface, disk access
and so on. Besides that, it also provides most of the features common to all
windows-based software. For example, the common dialog boxes, list boxes,
operating system settings, and even windows themselves are provided by the
Windows API [9].

Almost all functions in the Windows API are located in one of the Dynamic
Link Library (DLL) files found in the Windows System Directory. Windows API
allows any Windows-based program to access any API function easily. The bulk of
API functions are found in user32.dll (user interface functions), kernel32.dll
(operating system kernel functions), gdi32.dll (graphics device interface functions)
and shell32.dll (Windows shell functions) [9].
16

2.8 Graphical User Interface (GUI)

A graphical user interface (GUI) is a type of user interface that allows users
to interact with electronic devices with images rather than text commands. GUI can
be used in computers, MP3 players, gaming devices, office equipment and so on [10].
A GUI shows graphics objects such as image, icons, buttons, and scroll bars on the
screen.

GUI has some advantages. In general, it looks more professional. It can be


user-friendly and more attractive for non-technical people. Besides that, it can also
speed up the users work.

2.9 Event-driven Programming

Figure 2.5 The Event-Driven Programming Paradigm


17

Event-driven programming is a programming paradigm in which the flow of


the program is determined by events [9]. Event-driven programming is designed to
avoid limitations of sequential, procedure-driven methodologies. Figure 2.5 shows
the event-driven programming paradigm. The events are generated by user actions
such as touch event, mouse clicks, and key presses or messages from other programs.
Whenever the user touches the screen, an event is generated and sent to operating
system. Operating system detects an event has happened and sends a message to the
program. The program then acts on the message.

2.10 Microsoft Windows SDK

There are three types of software development kits which are Microsoft
Windows SDK, Platform SDK, and .NET Framework SDK. The Microsoft
Windows SDK is a set of tools, code samples, compilers, documentation, headers,
and libraries developers that can be used to create applications that run on Microsoft
Windows operating systems using Win32 or .NET Framework programming models
[11].

Windows SDK supports developing applications for Windows XP, Windows


Vista, Windows 7, Windows Server 2008, .NET Framework 3.0, .NET Framework
3.5, and .NET Framework 4.0 [11].
18

2.11 Architectural Overview of Touch

This section presents the architectural overview of touch. To program a


touch screen monitor, Windows SDK related to the touch screen must be installed.
Figure 2.6 shows how messages are generated from multi-touch hardware and sent to
the application window by Windows 7.

Figure 2.6 Processing messages for Windows touch input and gestures

Refer to the Figure 2.6, touch-sensitive hardware receives input from a user.
Then, the hardware and the operating system are communicated by a driver. Next,
the operating system generates a WM_TOUCH or WM_GESTURE message that is
then sent to an application's HWND. HWND stands for handle to the windows [12].

By default, the applications receive gestures. WM_GESTURE messages are


created by windows and sent to that application window if an application registers
for Windows touch input messages with the RegisterTouchWindow function [12]. If
an application window registers to receive touch messages, WM_TOUCH messages
are sent to that application window.
19

If Windows are bubbled up, they will interpret WM_GESTURE messages


and then send appropriate messages that map to the gesture [12]. Default Windows
Procedure provides default processing for any windows messages that an application
does not process.
20

CHAPTER 3

METHODOLOGY

3.1 Hardware and Software

In this project, both hardware and software are applied. The software used
includes Microsoft Visual Basic 2010, and Windows SDK while the hardware
involved in this project are a touch screen monitor, a computer and a webcam.

3.1.1 Touch Screen Monitor

The touch screen monitor used in this project is Acer 23 T231H multi-touch
monitor which is shown in Figure 3.1. The specifications for Acer T231H [13] are
shown in Table 3.1.
21

Figure 3.1 Acer 23 T231H Touch Screen Monitor

Table 3.1 Specifications for Acer T231H [13]


Feature Specification
Series name T231H
Display 23-inch Widescreen LCD
Aspect ratio 16:9
Maximum resolution 1920x1080
Response time 2ms
Contrast ratio 80000:1
Number of colors 16.7 million
Input signal VGA, DVI, and HDMI
Power consumption 35.5W

For Windows XP and Vista users, they will not capable to make full use of
the touch-sensitive features. Windows 7 starter and Home Basic can only recognize
single-touch actions while Windows 7 Ultimate, Enterprise, Professional and Home
Premium able to support multi-touch [13]. Once the monitor is connected to the
computer, it can be detected automatically.
22

For touch screen, lots of gestures are set up such as two-finger


finger tap, panning,
scrolling through documents and web-pages by moving a finger up and down on the
screen, rotating and zooming image in and out by moving two fingers apart or toward
each others, and flipping through photos by moving left or right [13].
[13]

3.2 Flow Process

Study the Microsoft


Design the
problem and Visual Basic
GUI
analysis 2010

Program for Windows Program for


multi-touch
touch SDK mouse click

Interface with Test for


webcam functionality

Figure 3.2 Process flow of the project

Figure 3.2 shows


show the flow process of this project in order to program a touch
screen monitor that can be used for cashier. Firstly,, the given problem is studied and
analyzed. Then the Graphical User Interface is designed. GUI that has been
designed is shown as in Figure 3.3. Touch screen monitor workss by using a variety
of different methods but the basic function
tion of using a Graphical User Interface
I (GUI)
that is sensitive to touch which is the fundamental to all approaches.
23

After designing the GUI, Microsoft Visual Basic 2010, which is the latest
version of Visual Basic is used to program for the mouse click. Microsoft Visual
Basic 2010 is a full-fledged Object-Oriented Programming Language, so it has
caught up with other OOP languages such as C++, Java, C# and others [19]. Next,
the Windows SDK which will integrated automatically with Visual Basic is installed
to program for the touch screen which supports multi-touch and other functions such
as swipe, flap, drag, tap and flick functions by modifying the program which
programmed by mouse click previously.

When the programming for GUI is completed, a webcam will be connected


and interfaced to the computer. The webcam is used to capture image of the product,
which then used to plot histogram of the image automatically. For example, if an
apple is captured by the webcam, the histogram of the apple will be plotted and the
information such as product name, price, barcode and description of the product will
be displayed automatically on the touch screen monitor. Finally, the program will be
tested to ensure that it is functioning well.
24

3.3 Graphical User Interface (GUI)

Main Window

Edit Database Username


Plot
Sale Multimedia and Item and Password Applications
Histogram
Details Setting

Password Cashier
Calculator
Verification Password
Play Video Slide Show

Price Manager
Print Receipt Record Notes
calculation Username
Play sound

Safety Manager
Edit Image
Function Password

Web browser

Figure 3.3 Graphical User Interface (GUI)

Figure 3.3 shows the Graphical User Interface of this project. This program
can be divided into six sub-modules
sub which are Sale, Plot Histogram, Multimedia,
Edit Database and Item Details, Username and Password Setting and Applications.
Applications
The products that are going to be purchased by the customers will be captured by a
webcam and being recognized. After the products have been recognized, the
information of the products will be taken from database and displayed automatically
on the touch screen monitor.

In order too do sale, cashiers must login with their correct username and
password. The program will calculate the total price of the products and will print
the receipt automatically to the customers. There is also a safety function in this
program which is used to block the windows quickly by using specific multi-touch
multi
function when being robbed by robber. This is to ensure that the robber
ro cant open
the drawer when they rob a supermarket.
25

Item details Menu


M is used to display the image, descriptions, barcode, and
price of each type of products. Edit Database Menu is very important in this project
because it acts as memory and used to store all the information of the products.
Besides that, this program can also be used to play multimedia such as video, sound
and slide show to do promotion. Username and password setting is used for both
cashier and manager to change their
their username and password anytime for safety
purpose. Last but not least, some other applications, which are calculator, edit
image, record notes, and web browser, are also supported in this program. A
calculator included in this program is to calculate the price if there are complaints
from customers regarding mistake of calculation of the price or mistake of the price
set in the database.

3.4 Windows Programming

3.4.1 Multi-touch
touch Gestures

This
his section describes the steps for using multi-touch
touch gestures. Before start
to program multi-touch
touch gestures, Windows SDK, which will integrate automatically
with Microsoft Visual Basic must be installed. Figure 3.4 shows typical steps that
are performed when using Windows Touch Gestures.
G

Set up a window
Handle the Interpret the
for receiving
gesture messages gesture messages
gestures

Figure 3.4
3. Steps for using multi-touch
touch gestures
26

The first step for using multi-touch gestures is to set up a window for
receiving gestures. By default, WM_GESTURE messages are received. Next step is
to handle the gestures messages, which is the same as handling Windows Touch
input messages. Since Win32 is used, WM_GESTURE message can be checked in
window procedure.

The final step is to interpret the gesture messages. Windows Touch gestures
can be interpreted by handling the WM_GESTURE message from the windows
procedure of an application. After handling this message, GESTUREINFO structure
which describes the gestures is retrieved. The structure, GESTUREINFO, has
information about the gesture such as the type of gesture and the location where the
gesture was performed [14]. The GetGestureInfo function is used to interpret a
gesture message into a structure describing the gesture. The GESTUREINFO
structure is retrieved by passing the handle of the gesture information structure to the
GetGestureInfo function [12]. The complete source code of programming multi-
touch gestures is shown in Appendix A.

Table 3.2 shows various identifiers for gestures that have been used in this
project while Figure 3.5 shows the flowchart of programming the multi-touch
gestures. Whenever the user touches the screen with his or her fingers, touch events
are generated. The system will pass the events to the operating system. Event
interpreter inside the operating system will interpret the events and translate the
events into messages which will then pass to the window procedure. When the
window procedure receives a message, it will check the gesture ID of the message.
For example, if the gesture ID is GID_TWOFINGERTAP, then two-finger tap
gesture will be performed. If not, window produce will determine whether the
message is another type of gestures such as pan, zoom, press and tap or rotate gesture.
If the message is not either one of these gestures, it will return to the window.
27

Table 3.2 Various identifiers for gestures


Name Value Description
GID_BEGIN 1 A gesture is starting.
GID_END 2 A gesture is ending.
GID_ZOOM 3 The zoom gesture.
GID_PAN 4 The pan gesture.
GID_ROTATE 5 The rotation gesture.
GID_TWOFINGERTAP 6 The two-finger tap gesture.
GID_PRESSANDTAP 7 The press and tap gesture.
28

Figure 3.5 Flowchart of programming multi-touch gestures


29

3.4.2 Plot Histogram of the Image

This section discusses how to plot histogram of the image. A color


representation in a computer is basically
basically made up of three channels which are the
quantity of red in that color (R), the
he quantity of green in that color (G), and the
quantity of blue in that
th color (B). A color of (R=0, G=0, B=0) is black and (R=255,
G=255, B=255) is white. Each quantity uses 8 bits to display and these three
elements will give a total of 16581.375 colors.
col A single channel,, which is an average
for three channels, can be chosen
c to plot the histogram. By averaging the values for
each channel, a value between 0 and 255 is always obtained. This value represents
the gray representation for that color.

Get the Count the


Average
color of number
the values Add to Draw the
each of pixels
for each the array histogram
pixel in for each
channel
the image value

Figure 3.6
3. Process of plotting histogram of an image

Figure 3.6 shows the process of plotting histogram of an image. In order to


compute a histogram in gray representation, first get the color of each pixel in the
image. Then average the values for each channel and add to the appropriate bin of
array. Next, count the
he number of pixels for each value and determine the maximum
value. Finally,, use Graphics Device Interface (GDI) to draw the histogram by
creating a pen to draw the bars on the screen. The source code of computing the
histogram of colors is shown in Figure
Figu 3.7.
30

Figure 3.7 Source code of computing the histogram of colors

3.4.3 Create Database Using Microsoft Access

This section discusses the way to create a database using Microsoft Access.
All the information of sale is recorded in Microsoft Access as shown in Appendix B.
The source code of connecting to the Access database is shown in Figure 3.8. The
technology used to interact with a database or data source is called ADO.NET. ADO
stands for Active Data Objects [15].
31

Figure 3.8 Source code of connecting to Access database

To create a database, first a new data source is added to the project. After
that, database code is written in the Visual Basic. The OLE DB connection object is
required since Access database is used in this project [15]. OLE stands for Object
Linking and Embedding. OLE DB objects or called data providers that used in this
project is called "Jet".

Next step is setting a connection string. Two things will be passed to new
Connection Object which are the technology used to do the connection to the
database and where the database is. By referring to the source code in Figure 3.8,
provider technology used to do the connection in this project is JET and the name
of the Access file connected to is database.mdb. After setting a connection string,
the database can be opened. Once opened, the connection has to be closed again.

Data Set is used to store all the information from the database so that the
information can manipulated. The Data Adapter will contacts the Connection Object,
and then executes a query that has been set up. The results of that query are then
32

stored in the Data Set. Structured Query Language or in short called SQL is a way to
query and write to databases, not
no only Access [15]. Data Set can be filled by Data
Adapter with records from a table
t called tblcontact. The data from the database will
be accessed to use in Sale Menu, Edit Database Menu and Item Details Menu.

3.4.4 Webcam Interface

This section discusses


discuss how to interface a webcam
cam to capture the image of
product which then will be used to plot the histogram automatically. In this project,
avicap32.dll (video for windows)
window is used. Windows programs do not access webcam
device directly. It uses Graphics Device Interface (GDI) to interface to the webcam
which is shown in Figure 3.9.

Hardware
Program GDI
(Webcam)

Figure 3.9 Webcam interface using Graphics Device Interface (GDI)

The Graphics Device Interface is an interface for working with graphics


which is part of the GDI32.DLL
G (library). The GDI insulates the programmers from
the hardware. It is used to interact with graphic devices such as webcam, monitor,
printer and a file. The GDI allows programmers to display data on screen without
having to be concerned about the
t details of a particular device.
33

Figure 3.10 Webcam capture using the GDI and DC

Figure 3.10 shows the process of capturing the image which will be displayed
on the screen of the monitor. A Device Context (DC) is used to describe the
attributes of text and images that are output to the screen. The actual context is
maintained by GDI. A handle to the Device Context (HDC) is obtained before
output is written and then released after elements have been written [9].

3.4.5 Calculator

This section discusses how to program the calculator that has been designed
in this project. Figure 3.11 shows the flowchart of programming calculator. When
the window form of calculator is displayed, the program will initialize.

The program will check whether there is a button clicked or not. If there is a
button clicked, the program will continue to check whether the button clicked is a
number. If so, the number will be displayed on the text box and stored in an array,
else the program will continue to check is not operator such as addition, subtraction,
multiplication, division, power and square is activated. If this condition is true, the
34

program will further check which operator is activated and the operator will be stored
in an array, else either backspace, clear or off function will be performed.

Finally, the program will compute the result if the operator equal button is
clicked. Once the result has been computed it writes the result to the text box
provided and it either waits for the computation to continue or waits for the user to
start a new computation by inputting an operand, which subsequently clears the
screen and discards the previous result. Otherwise, the user can continue the
computation by inputting an operator (+, -, x, /, pwr, or sqr) followed by
operands and operators after the printed result. As with a normal calculator, the user
has the option to clear the screen and cancel a computation at any point with a click
of the assigned clear button.
35

Figure 3.11 Flowchart of programming calculator


36

3.4.6 Cashier or Manager Login

Figure 3.12 Flowchart of the login process

Figure 3.12 shows the flowchart of the login process. Firstly, the username
and password are obtained from a text file which contains the values of username
and password of the manager or cashier. Text file is used to store the username and
password that have been changed or updated. Next, the program will check whether
there is any text entered in the text box. If this condition is false, notification of no
text entered will be shown on the screen, else the program will continue to check
whether or not the username and password entered are equal to the username and
password obtained from the text file. If the username and password are equal, the
37

login process is successful and new window will be displayed, else notification of
error will be shown.

3.4.7 Change Username or Password

Figure 3.13 shows the flowchart of changing the username or password. The
username or password is obtained from a text file. The program will check is there
any text entered in the text box. If there is a text, the program will check whether or
not the current username or password entered is equal to the username or password
in the text file and then continue to check whether the new username or password
entered is equal to the confirm username or password entered. If this condition is
true, the new username or password entered will be updated to the text file, else the
notifications of error will be displayed.
38

Figure 3.13 Flowchart of changing the username or password


39

CHAPTER 4

RESULT AND DISCUSSSION

4.1 Introduction

This chapter will present the results of the project. There are many windows
have been designed and programmed. The GUI of this project was designed based
on the Iteration Design Guide for Touch Screen Application [16]. The way to use
the program and the functions of each window will be presented in this chapter.

4.2 Touch Capabilities

Table 4.1 shows the list of touch gestures that have been programmed and the
gestures action. All the gestures are supported in Windows 7. There are five multi-
touch gestures which are pan, press and tap, zoom, rotate and two-finger tap. In table
4.2, it presents about the synthesized equivalent message and where the gestures
have been applied in this project.
40

Table 4.1 List of touch capabilities


Gesture Gesture Action Action
( =finger down| =finger up)
Panning with Drag one or two fingers up
Inertia and down

Press and Tap Press on target and tap using


a second finger

Zoom Move two fingers apart or


toward each other

Rotate Use one finger to pivot


around another

Two-Finger Tap Tap two fingers on the


screen at the same time

Press and Hold Press, wait for blue ring


animation to complete, then
release

Flick Make quick drag gestures in


the desired direction
41

Table 4.2 Equivalent message and used of the gestures


System Gesture Windows Usage Use
Tap (down and up) Mouse left click Button, image and icon
Double tap Mouse double left-click -
(down and up
twice)
Panning with inertia Scrolling List box
Press and tap Mouse right click Close the windows
Zoom Zoom Zoom image in or out,
Maximize and minimize the
windows
Rotate Not available Safety function
Two-finger tap Not available View help, print receipt
Press and hold Mouse right click Open or save file
Flick Pan up, down, back and Pan up, down, left and right
forward to open another window
42

4.3 Login Menu

Figure 4.1 Login Menu

Figure 4.1 shows the Login Menu of this project. To use this program, the
manager must login with the correct username and password. If the login successful,
Main Menu as shown in Figure 4.2 will be shown, else a message box of asking the
user to re-enter the username and password will be displayed. The user can tap two-
fingers on the screen of this menu at the same time to view the help, which is a
window that shows to the user how to perform multi-touch gestures. Lastly, the user
can apply press and tap gesture to close this window.
43

4.4 Main Window

Figure 4.2 Main Menu

The Main Menu of this project is shown in Figure 4.2. This program can be
divided into six sub-modules which are Sale, Plot Histogram, Setting, Edit Database
and Item Details, Multimedia and Applications. The user has to select an option to
continue by clicking the icon in the Main Menu. To close the window, perform press
and tap gesture.
44

4.5 Cashier Login Menu

Figure 4.3 Cashier Registration Menu

Figure 4.3 shows the Cahier Registration Menu. In order to do sale, cashiers
must register themselves by entering cashier name, cashier identification number,
and password in the text box provided. Cashier name and cahier identification
number entered will be passed to the Sale Menu once the registration is successful.
Apart from this, the cashiers can pan right to change their username or password if
necessary. To close this window, apply press and tap multi-touch gesture.
45

4.6 Sale

Figure 4.4 Sale Menu

Figure 4.4 shows the Sale Menu that has been designed for cashier. Let say a
customer buy a Green Apple, the cashier has to select Green Apple from the list box.
Then the name, price, quantity, discount and amount of the Green Apple will be
displayed in the data grid view as shown in Figure 4.4. The total price of the
products bought by the customer will be calculated and displayed in the text box
named Total Sale by clicking a button named Total. Next, cashier has to enter the
amount paid by customer and click the Payment button. The total amount that
cashier should return to the customer will be calculated and displayed in the text box
named Return. Thus, the sale process is completed and cashier has to print the
receipt by clicking the Print Receipt button or apply the two-finger tap gesture. The
receipt printed is shown in Figure 4.5. Lastly, click the Next Customer button to
clear all values and do the new sale.
46

If there is robbery occurred, the cashier can perform the rotate multi-touch
gesture by using one finger to pivot around another to block the windows. All the
windows will be hidden and emergency sound will be played until the manager login
the window again to return to the Sale Menu. The Safety Window is shown in
Figure 4.6. This is for safety purpose. Therefore, the robbers are unable to interact
with the windows to rob the money.

Figure 4.5 Receipt


47

Figure 4.6 Safety Window

4.7 Plot Histogram

Figure 4.7 shows the Plot Histogram Menu. To plot the histogram, first the
cashier has to click the Auto button in the Sale Menu. Then, use a webcam to
capture the image of the product. Image captured will be sent to Plot Histogram
Menu and the histogram of the product will be plotted automatically. The histogram
plotted is able to recognize the product captured. For instance, if the image captured
is a Red Apple, the histogram will be plotted and being recognized as Red Apple.
Finally the information of the Red Apple will be displayed automatically as shown in
Figure 4.7.
48

Figure 4.7 Plot Histogram Menu

4.8 Database Menu

Figure 4.8 shows the Database Menu, which is used to display, add, update
and delete a record. All the information of each product will be displayed by
clicking the navigation buttons at the bottom of the menu. If there is a new item
arrives in the supermarket, new record should be added. This is done by clicking the
Add New button. All the text box will be cleared and add the information of the new
product in the text box provided. Then click the commit button. A message box will
be shown to inform the user that a new record has been added to the database.

The information of the products in the database can be updated from time to
time by entering the latest information in the text box provided followed by clicking
the Update button. A message box will be shown to inform the user that the
49

information has been updated. The user can click the Delete button to delete a record
from the database. This menu is also linked to the Item Details Menu directly. So,
the user only has to pan right with his or her finger to go to Item Details Menu.

Figure 4.8 Database Menu


50

4.9 Item Details Menu

Figure 4.9 Item Details Menu

Figure 4.9 shows the Item Details Menu. This menu is used to view the
details of the products such as image, price, barcode, and description by selecting
any product from the list box on the left of the menu. The manager and cashier can
click the image in the Item Details Menu to go to Image Preview Menu which is
shown in Figure 4.10 to view the image. They can put two fingers on the screen and
move the fingers toward or apart from each other to zoom in and out of the image.
Apart from this, user can make a quick drag to the right to go to Database Menu
directly.
51

Figure 4.10 Image Preview

4.10 Username and Password Setting

There are three menus of changing the username and password, which are
Change Manager Username Menu, Change Manager Password Menu, and Change
Cashier Password Menu as shown in Figure 4.11, Figure 4.12 and Figure 4.13
respectively. When the managers or cashiers want to change their username or
password, they should enter their current username or password and new username
or password twice, then click the change username or password button. If the
username or password changed successfully, a message box will shown to tell them
that the username or password has been changed. Besides that, they can pan right or
pan left to go to another desired window.
52

Figure 4.11 Change Manager Username Menu

Figure 4.12 Change Manager Password Menu


53

Figure 4.13 Change Cashier Password Menu

4.11 Multimedia

Under multimedia, there are three menus which are Play Sound Menu, Play
Video Menu and Slide Show Menu as shown in the Figure 4.14, Figure 4.15 and
Figure 4.16 respectively. Normally Play Sound Menu is used by cashiers to play the
price when the customers are blind people. The price that should be paid by the
blind people will be played to them by selecting the correct price from the list box.
If the amount of price that should be paid by the customer is not in the list, cashier
can press their finger on the screen and hold until the blue ring appear, then release
the finger to browse and insert the desired media file. Once a media file is being
played, cashier can adjust the volume by moving the track bar on the right of the
menu. Apart from this, this menu consists of three buttons which are Play, Stop and
Pause button as controller.
54

Play video Menu is used to do the promotion by playing a promotion video.


The user can double tap the screen to display the video in full screen. There is a
default promotion video set in the program. So, if the user wants to play another
promotion video, just click on the file, then select open to browse and choose the
desired video to play. For slide show, it is used to do promotion by displaying the
images. User can put his or her finger on the screen and apply press and hold gesture
to browse and select a file to play the slide show to do promotion.

Figure 4.14 Play Sound Menu


55

Figure 4.15 Play Video Menu

Figure 4.16 Slide Show Menu


56

4.12 Applications

Figure 4.17 Calculator

Figure 4.17 shows the calculator that has been designed for cashier to
calculate the total price manually and to double confirm the total price when the
customer unsatisfied with the amount calculated in Sale Menu. The operation of this
calculator is the same as normal calculator. It performs the addition, subtraction,
multiplication, division, power and square functions. Panning with inertia gesture
has been applied in this menu. The user can pan right, left, up and down to go to the
Image Preview Menu, Record Notes Menu, Edit Image Menu and Web Browse
Menu respectively.
57

Figure 4.18 Record Notes Menu

Figure 4.18 shows the Record Notes Menu that has been designed for
manager or cashier to record some notes. They only have to use one finger to write
the notes on the screen. After that, apply press and hold gesture to save the notes as
image in the computer.

Edit Image Menu is shown in Figure 4.19. This menu is used to edit the
image captured from webcam if necessary before store the image in database. It can
be used to zoom, rotate, flip and crop the image. Figure 4.20 shows the Web
Browser Menu, which is used to online to search information. The functions are
same as normal internet browser like Internet Explorer and Mozilla Firefox.
58

Figure 4.19 Edit Image Menu

Figure 4.20 Web Browser Menu


59

CHAPTER 5

CONCLUSION AND FUTURE WORK

5.1 Conclusion

Recent developments in science and technology provide a wide range scope


of applications of touch screen in area such as cashier system, information kiosks,
ATM machine, mobile phones and so on. Touch screen monitor is a new technology
and very useful for cashier to ensure that the sales can be performed faster and
smoothly. Touch screen monitor also able to help the cashiers to reduce the space of
the table since it can acts as both input and output device and no external keyboard
and mouse are required.

Besides that, Microsoft Visual Basic 2010 and Windows SDK are suitable for
Windows Programming of touch screen monitor with many graphics interface.
Lastly, webcam can be interfaced using Visual Basic to capture the image for
recognition of the products. This is very useful for cashier since the information of
the products will be displayed on the screen automatically once the products are
being recognized.
60

5.2 Future Works

The complete GUI for cashier system has been designed in this project.
However, it is still cannot be used for cashier because the complete cashier system
have not formed. In future, this project must combined with the image processing
part such as barcode, color, shape and texture recognition of the products to form a
complete system.

The multi-touch gestures that had been programmed in this program are only
support up to two fingers. In future, it is recommended to program more multi-
touch functions which can support more than two fingers at the same time. Thus,
two cashiers can share to use one touch screen monitor during the sales to save the
space and cost.
61

REFERENCES

1. Touch screen. http://en.wikipedia.org/wiki/Touchscreen


(Retrieved on 12th August 2010)

2. Touch screen history. http://www.ehow.com/about_5535302_touch-screen-


history.html (Retrieved on 4th October 2010)

3. Construction of touch screen set. http://www.4ugmbh.de/Manuals/SAW


TOUCH SCREEN (12.1-GT).pdf (Retrieved on 19th October 2010)

4. Types of touch screen. http://www.scribd.com/doc/17051638/Touch-Screen


(Retrieved on 8th October 2010)

5. How do touch screen monitor know where you are touching.


http://computer.howstuffworks.com/question716.htm (Retrieved on 4th
November 2010)

6. How touch screen works. http://www.cmsstores.com/how-touch-screen-works/


(Retrieved on 17th November 2010)

7. Infrared touch screen technology.


http://www.touchscreensolutions.com.au/Technology-and-Innovations/infra-red-
touch-screen-technology.html (Retrieved on 15th October 2010)

8. A seminar report on touch screen. http://www.scribd.com/doc/17051638/Touch-


Screen (Retrieved on 8th September 2010)
62

9. The Forgers Win32 API Programming Tutorial.


http://www.winprog.org/tutorial/message_loop.html (Retrieved on 5th January
2011)

10. Graphical User Interface. http://en.wikipedia.org/wiki/Graphical_user_interface


(Retrieved on 26th October 2010)

11. Microsoft Windows SDK.


http://en.wikipedia.org/wiki/Microsoft_Windows_SDK (Retrieved on 10th
February 2011)

12. Architectural overview.


http://msdn.microsoft.com/enus/library/dd371413%28v=vs.85%29.aspx
(Retrieved on 4th May 2011)

13. Acer T231H multi-touch monitor.


http://www.theinquirer.net/inquirer/review/1729125/acer-t231h-multi-touch-
monitor (Retrieved on 25th February 2011)

14. MSDN Library. http://msdn.microsoft.com (Retrieved on 28th October 2010)

15. Create database in VB.NET. http://www.homeandlearn.co.uk/net/nets12p1.html


(Retrieved on 8th December 2010)

16. Gerd Waloszek (December 2000). Interaction Design Guide for Touch Screen
Applications. URL
http://www.sapdesignguild.org/resources/tsdesigngl/index.htm (Retrieved on 28th
August 2010)

17. Alan Andrew Vazquez (1990). Touch Screen use on flight Simulator
Instructor/Operator Stations. Masters Thesis, Naval Postgraduate School
Monterey, California.
63

18. Julius Schwarzweller, Fleming Kahn (2007). Development of a Java based


Cashier System using Java POS and MySQL Database. Bachelors Thesis,
University of Applied Sciences Hamburg.

19. Paul Deitel and Harvey Deitel (2010). Visual Basic 2010, How TO Program, 5th
Edition. Prentice Hall

20. Rod Stephens (2008). Visual Basic 2008 Programmers Reference. Wiley
Publishing.
64

APPENDIX A

SOURCE CODE OF MULTI-TOUCH GESTURES

Imports System.Security.Permissions
Imports System.Runtime.InteropServices

Private first_point As New Point()


Private second_point As New Point()
Private iArguments As Integer = 0
Private Const ULL_ARGUMENTS_BIT_MASK As Int64 = &HFFFFFFFFL
Private Const WM_GESTURENOTIFY As Integer = &H11A
Private Const WM_GESTURE As Integer = &H119
Private Const GC_ALLGESTURES As Integer = &H1
Private Const GID_BEGIN As Integer = 1
Private Const GID_END As Integer = 2
Private Const GID_ZOOM As Integer = 3
Private Const GID_PAN As Integer = 4
Private Const GID_ROTATE As Integer = 5
Private Const GID_TWOFINGERTAP As Integer = 6
Private Const GID_PRESSANDTAP As Integer = 7
Private Const GF_BEGIN As Integer = &H1
Private Const GF_INERTIA As Integer = &H2
Private Const GF_END As Integer = &H4

Private Structure GESTURECONFIG


Public dwID As Integer
Public dwWant As Integer
Public dwBlock As Integer
End Structure

Private Structure POINTS


Public x As Short
Public y As Short
End Structure
65

Private Structure GESTUREINFO


Public cbSize As Integer
Public dwFlags As Integer
Public dwID As Integer
Public hwndTarget As IntPtr

<MarshalAs(UnmanagedType.Struct)>
Friend ptsLocation As POINTS
Public dwInstanceID As Integer
Public dwSequenceID As Integer
Public ullArguments As Int64
Public cbExtraArgs As Integer
End Structure

<DllImport("user32")>
Private Shared Function SetGestureConfig(ByVal hWnd As IntPtr, ByVal
dwReserved As Integer, ByVal cIDs As Integer, ByRef pGestureConfig As
GESTURECONFIG, ByVal cbSize As Integer) As
<MarshalAs(UnmanagedType.Bool)> Boolean
End Function

<DllImport("user32")>
Private Shared Function GetGestureInfo(ByVal hGestureInfo As IntPtr, ByRef
pGestureInfo As GESTUREINFO) As <MarshalAs(UnmanagedType.Bool)>
Boolean
End Function

Private _gestureConfigSize As Integer


Private _gestureInfoSize As Integer

<SecurityPermission(SecurityAction.Demand)>
Private Sub SetupStructSizes()
_gestureConfigSize = Marshal.SizeOf(New GESTURECONFIG())
_gestureInfoSize = Marshal.SizeOf(New GESTUREINFO())
End Sub
<PermissionSet(SecurityAction.Demand, Name:="FullTrust")>
Protected Overrides Sub WndProc(ByRef m As Message)
Dim handled As Boolean

Select Case m.Msg


Case WM_GESTURENOTIFY
Dim gc As New GESTURECONFIG()
gc.dwID = 0
gc.dwWant = GC_ALLGESTURES
gc.dwBlock = 0
66

Dim bResult As Boolean = SetGestureConfig(Handle, 0, 1, gc, _gestureConfigSize)

If Not bResult Then


Throw New Exception("Error in execution of SetGestureConfig")
End If
handled = True

Case WM_GESTURE
handled = DecodeGesture(m)

Case Else
handled = False
End Select

MyBase.WndProc(m)

If handled Then
Try
m.Result = New IntPtr(1)
Catch excep As Exception
Debug.Print("Could not allocate result ptr")
Debug.Print(excep.ToString())
End Try
End If
End Sub

Private Function DecodeGesture(ByRef m As Message) As Boolean


Dim gi As GESTUREINFO

Try
gi = New GESTUREINFO()
Catch excep As Exception
Debug.Print("Could not allocate resources to decode gesture")
Debug.Print(excep.ToString())

Return False
End Try

gi.cbSize = _gestureInfoSize

If Not GetGestureInfo(m.LParam, gi) Then


Return False
End If

Select Case gi.dwID


Case GID_BEGIN, GID_END

Case GID_TWOFINGERTAP
Receipt.Show()
Invalidate()
67

Case GID_ZOOM
Select Case gi.dwFlags
Case GF_BEGIN
iArguments = CInt(Fix(gi.ullArguments And
ULL_ARGUMENTS_BIT_MASK))
first_point.X = gi.ptsLocation.x
first_point.Y = gi.ptsLocation.y
first_point = PointToClient(first_point)
Case Else
second_point.X = gi.ptsLocation.x
second_point.Y = gi.ptsLocation.y
second_point = PointToClient(second_point)

Invalidate()
End Select

Case GID_PAN
Select Case gi.dwFlags
Case GF_BEGIN
first_point.X = gi.ptsLocation.x
first_point.Y = gi.ptsLocation.y
first_point = PointToClient(first_point)
Case Else
second_point.X = gi.ptsLocation.x
second_point.Y = gi.ptsLocation.y
second_point = PointToClient(second_point)

Invalidate()
End Select

Case GID_PRESSANDTAP
If gi.dwFlags = GF_BEGIN Then
Invalidate()
End If

Case GID_ROTATE
Select Case gi.dwFlags
Case GF_BEGIN
iArguments = 0
Case Else
first_point.X = gi.ptsLocation.x
first_point.Y = gi.ptsLocation.y
first_point = PointToClient(first_point)
Invalidate()
End Select

End Select
Return True
End Function
68

APPENDIX B

ACCESS DATABASE

Figure B.1 Access Database

Você também pode gostar