Normally windows forms applications proceeds execution as the user gives the input(s).
ex : Click a Button.
Until then does the application busy waits ?
(go and check whether "a button" has been "clicked".I mean check if any event has occured)
or when an event occurs does the OS interrupts the applications ?
What is the exact event handling mechanism for Windows forms applications ?
No, they don't busy wait: they run a Windows Message Pump that is a loop which blocks until Windows has a message to give to it.
This is basically what Application.Run does.
I don't have much knowledge about it to share. But surely will share my peanuts.
Program does not wait for any one. Its like in sleep mode. Does consume resource but just to keep its GUI on screen.
Event handling are not Program based or OS based. Its hardware based. When you click your mouse or press a key on keyboard, its considered to be Asynchronous External activity. Hardware intimates the OS about the action taken by the user or a external device and the information is passed to the the corresponding Program. The Program can accept the Key or reject it. If it accepts, the key is passed to the Event handlers and required action is generated. OS is not at all involved in the process. Its more or less like a mediator which converts the Native Code into Program readable Code. And that is one of the reason the programs are OS specific. I mean what if OS converts Native Code in a format which program can not read??
You are talking about a Event in Windows based application, lets imagine the case of USB. There are 8 or more than 8 USB slots in the motherboards today. A user can plug the USB in any slot. Do OS keep waiting that a USB will be inserted and in every slot it keep tracking and waiting?? NO. Not at all. Its a hardware based process and its the duty of hardware to intimate OS about it. Windows Compatible and Linux Compatible communities come in to picture here, where they discuss that which hardware is which OS supported.
See this to know more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With