English 中文(简体)
Browsers and Windows Messaging
原标题:

I was asking myself how the browsers are working. How does the browser tell to the OS to change the mouse pointer from arrow to hand(IDC_HAND) for example. In desktop application I know that are used windows messages(right) but how it is happening in browsers? Spy++ doesn t seems to catch any of the mouse pointer messages in this case. Can you help me with an explanation?

I m trying to build a C# application which will detect the type of the mouse pointer.

问题回答

You can define a specific cursor for each window class. Consult the documentation for the function RegisterClassEx and structure WNDCLASSEX

HTH.

The browser viewport is a simple window with hardly any standard events. A page is rendered by pixel and treated later as a bitmap. A browser builds an hierarchy of web page controls and display elements and keeps it in memory. Whenever mouse moves across the page, the browser algorithms search through this hierarchy to identify whether these particular coordinates belong to, say, a button or a link and then change the cursor to pointer. In short, it s what a browser engine is all about. Parse HTML to an hierarchy of controls, then parse CSS and update properties of these elements then render the controls under consideration of their properties to a viewport, then process user input and when required initiate a request. Browser engine also executes JavaScript code and performs manipulation on the document structure.

Remember also that FireFox exists for Linux as well in which case it would make no sense for browser developers to work with standard windows events. Some basic initialization code is definitely platform dependent but after the window is prepared and user input is forwarded through some abstraction layer to the core, then the browser engine leads the play with no concern for the underlying operating system and its event system whatsoever.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签