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
MFC hides WinMain in its framework and includes source file on WinMain(). This explains how framework calls global CWinApp::Initinstance() from entry WinMain.
This is constructed during global C++ objects are constructed and is already available when Windows calls the WinMain function, which is supplied by the ...
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.
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.
LPARAM and WPARAM are the two parameters in Window CallBack procedure. They signifies parameters of various events. They are used in handing individual events.
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 ...
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average