DOS Operating system runs on real mode operation on x86 architecture. In this operating mode there is no protection and security from operating system so that it can block the access from application so that it can prevent application from accessing hardware directly.

Windows operating system runs on protected mode on x86 architecture. In this mode operating system runs on higher privilege level also known as kernel mode. Only Kernel mode can access hardware and other protected resources. Application layer or user layer runs on less privilege level also known as user mode. Here operating system can define I/O protection level and security of memory for application. Thus application can never access hardware.

Windows provides APIs to access hardware from application layer. It supports all kinds of hardware API to access system hardware uniformly but never gives the access directly. There are two advantages. First of all application can never cause illegal access to hardware which can be fatal at runtime. Also application calls APIs to access hardware which decouples the application from specific hardware. Application never knows what is the exact hardware it is talking to. It actually talks to logical file of the hardware. It is the responsibility of driver and OS to manage hardware specific interfaces. Thus any application can run on any system without any modification. In these way windows makes the upper layer of the operating system hardware independent.

About our authors: Team EQA

Further readings

Where is WinMain() function in MFC application ?

MFC hides WinMain in its framework and includes source file on WinMain(). This explains how framework calls global CWinApp::Initinstance() from entry WinMain.

What is the utility of CWinApp class?

This is constructed during global C++ objects are constructed and is already available when Windows calls the WinMain function, which is supplied by the ...

Basic steps in Win32 GUI Application with source code.

Define a custom Window class structure, Register the class name, CreateWindow, Show windows and write message get and dispatch loop statements. Define the Window CallBack procedure and write the handlers.

What is a Window CallBack procedure and what is its utility?

DispatchMessage() is a API which indirectly triggers the Window CallBack procedure. Message structure members from this function are passed to the CallBack procedure. CallBack procedure should implement event handlers depending on the need of the application.

What are LPARAM and WPARAM in window proc function?

LPARAM and WPARAM are the two parameters in Window CallBack procedure. They signifies parameters of various events. They are used in handing individual events.

What are the basic steps of a typical MFC based application?

We need to write WinMain and need to follow all these in a Win32 application. However we need not to write much if we are writing an application with MFC ...