The conventional console based programs (DOS & UNIX based) used to call the system calls such as read() to read a data from keyboard through some library. (e.g.): The device driver of keyboard stores the actual data (key pressed) in system buffer. A library (stdio) collects this data and passes to a program when a program calls read() system call. i.e a program reads the keyboard buffer when it is required. OS does not convey any message that a character has arrived from keyboard. The following flow explains this in simple form.
Keyboard driver : Keyboard —–> A key is pressed ——> data is stored in system bufferApplication Program : read() —–> if data is in keyboard buffer —–> data is read by application
In Windows OS, this scenario is different. OS makes call to application program. Let me put it in detail. (e.g.): Whenever a key is pressed in a keyboard, Windows (OS) store that event (e.g: Key Pressed or Released) and data in the system message queue. OS analyses that message and identifies the window belonging to that message. From this information, it can identify the process (thread) which created this window. OS then passes on this event to this thread’s message queue. This thread runs a loop processing the incoming messages. i.e OS conveys the message to an application. The following flow explains this in simple form. Note: An application thread may have more than one window. So a window does not mean an application, it means one of the windows of that application.
Keyboard driver : Keyboard —–> A key is pressed —-> this event and data are stored in system message queue (OS level)
Windows (OS) : Identifies window of the message —-> Identify the corresponding thread —-> Post the message to that thread’s message queue (Application level).
Application (thread) : Get the message —-> Translate the message (converting virtual key codes into actual characters) —–> Post back to thread’s message queue —-> Dispatches message to corresponding window procedure by calling that procedure.
Window Procedure : Identify the message type and act on that —-> complete and returns to application thread to retrieve the next message.
DispatchMessage() is a function implemented by the OS, which is called by the application thread. So the window procedure of an application is called by the OS!!! It is really strange from conventional programming.
What is 16/32 bit programming?
Before knowing about programming, let us see what is 16 bit or 32 bit all about. The 16 or 32 bits, we talk about is nothing but the data bus width supported by the microprocessor. If a microprocessor can fetch 32 bits (4 bytes) of data during a memory read operation, it is called 32 bit microprocessor.
Intel followed 16 bit architecture till 80286 processor. The memory mode for this architecture is called Segmented memory mode. In this mode, each memory address is specified as segment and offset. It was a bit messy for programmers to handle these segment – offset concept. Here int data type in C, is 16 bits in size (2 bytes). Windows 1.0 to 3.1 followed this, which resulted in Win16 API.
From 80386 processor, Intel switched over to 32 bit architecture. It follows Linear memory model. No segment – no offset. C int data type has become 32 bits (4 bytes) and pointers are all 32 bits. Neat and clean. Starting from Windows 95 and NT 3.1, windows became 32 bit operating system which runs on 80386 and higher versions. This resulted in Win32 API.
What is Windows API?
Windows Kernel and Device drivers
Application Programming Interface (API) is the library offered by the Operating system to its developers to develop an application to run on this OS. Through API, a user mode program can access services offered by OS. There is a layer called System Call Interface, through which traditional UNIX programmers use to access OS services. Then why should we want Operating System Level API in Windows? Unlike UNIX, Windows abstract the many system call interfaces in to a single API call to make the programmer’s job easy ( 🙂 so that they can spend more time on forwarding emails and reading a round robbin mail for 10th time in a year). Apart from this, Windows has Graphical User Interface (GUI) as part of kernel. The graphical screen elements (Windows, buttons, menus, etc.) are simplified through API. This makes the programmers need not to worry about the finite element which is not related to the end user’s requirements. It is simple to call a function like CreatWindow() instead of calling many open,read and write system calls to create a window in screen. Since the API is implmented by the operating system, it knows the better way of calling system call interfaces.
Thank God, some how I have managed to justify my programming work on Windows API. 🙂
I use to enjoy when I do Win32 API Programming. So far I have worked on it without any formal learning. I think this is high time to make my understanding neat and clean on Win32. Here is my attempt to start summarizing the essentials of Win32 Programming which I enjoy. I am going to post Win32 basics in this blog. This is not going to be a complete Win32 learning plot, but it will definitely help myself and others to brush up the existing knowledge in Win32. I am not going to cover the deep root topics, since I don’t know much of them. Charles Petzold’s “Programming Windows” is the good book to start. I prescribe that book for any one who start learning Win32 programming.
Thanks to my friend Mr.Suresh, who is conducting Win32 classes for freshers in our office. I attended a session, seems to be useful for me also. Suresh is strong in Win32, he will help me in making this series useful to everyone. I welcome the readers to comment on mistakes if any in the postings..!
After all sharing knowledge is nothing but learning! 🙂
Sometimes we encounter “Firewall – Access denied for the web site you requested!” message while surfing from a corporate network. Unfortunately, firewalls sometimes rate a good valid site as blacklisted site. In that case we use to request our system administrator to whitelist that site. This tool comes in handy for this purpose. Once you encounter this message, you have to just click “Request Access!” menu in Tools menu of firefox. Now your mail requesting administrator to unblock the site is ready in your default mail client. Just click “Send”. That is it. Your System Administrator’s email-id and your Full name are configurable through Options button in extensions dialog.
This is my first contribution to open source world. My first firefox extension too. Welcoming your comments for this tiny tool..!
I had submitted this extension to mozilla for approval. Today it has been approved and listed in Mozilla site. You can download it from here:
I have installed SimplyMEPIS 3.4-1 (RC1) in my nx6120 HP Laptop. Hardware detection is simply superb. Almost all the hardware are working out of the box without any configuration. This is the first Linux desktop I have seen working most of the hardware without going and tweaking in command shell. OS Centre tool is doing wonder.
But I had a issue of not able to see the complex script fonts like my mother tongue, Tamil in Firefox (It works with Konqueror). Complex script is enabled in firefox with the help of pango library. By default this library is disable in firefox configuration. The workaround is just adding “MOZ_ENABLE_PANGO=1” in /etc/mozilla-firefox/mozilla-firefoxrc file. Now restart the firefox. Now you can see the complex script fonts like indian fonts properly.
My hope for Linux Desktop goes high after experiencing the MEPIS. Simply Superb! This is a good distribution for beginners to start!
You can also try by downloading it from here.