Customized by wince ie browser-supports touch screen sliding

Source: Internet
Author: User

 

 

 

Because WEB browsers need to be integrated into existing products, the browsers that come with IE do not support sliding pages on the touch screen, and the user experience of IE itself is not flattering. How can we customize ie browsers? The following describes how to customize IE to support touch screen sliding.

After WINCE6.0 is installed, there are two folders, IESAMPLE and IESIMPLE, under the % _ WINCEROOT %/Public/Ie/Oak directory. IESAMPLE is the source code of IE's standard version under CE, tool bar, status bar, address bar, Internet Options, favorites, etc. It is almost the same as PC Windows's IE. IESIMPLE is a simplified version that only contains the basic IWebBrowser control. We can customize the browsers we need based on the two IE source code. Shows the IESIMPLE directory:

 

If you don't talk much about it, we will use the IESIMPLE source code to customize a web browser that supports touch and slide operations.

 

Create a smart device WIN32 project under VS2005, and copy the four files mainwnd. cpp, mainwnd, IESIMPLE. rc, and resource. h under the iesimple directory to the new project directory. You can also directly find iesimple in PB and right-click build, as shown in, and then go to the PB project realtrans directory to generate

Copy iesimple.exe to the device. However, PB does not support online debugging. After each build, you must manually copy the executable file to the device for running. Creating a project directly saves the trouble and does not affect the original WINCE600 code.

First, compile the program directly. The normal program can be compiled smoothly. You can copy the generated .exe file to the device to run the program.

 

To enable IE to support page flip, ie can respond to the wm_mousemove message, but the iwebbrowser control does not process the wm_mousemove message, here, we use the process processing function to intercept wm_lbuttondown, wm_mousemove, and wm_lbuttonup in the message loop and deliver the message to the main form. Find the newwindow thread function in mainwnd. cpp and add the following code:

While (getmessage (& MSG, null, 0, 0) <br/>{< br/> switch (MSG. message) <br/>{< br/> case wm_lbuttondown: <br/>{< br/>: sendmessage (pwnd-> _ hwnd, MSG. message, MSG. wparam, MSG. lparam); <br/> break; <br/>}</P> <p> case wm_mousemove: <br/>{< br/> :: sendmessage (pwnd-> _ hwnd, MSG. message, MSG. wparam, MSG. lparam); <br/> break; <br/>}< br/> case wm_lbuttonup: <br/>{< br/>:: sendmessage (pwnd-> _ hwnd, MSG. message, MSG. wparam, MSG. lparam); <br/> break; <br/>}</P> <p> If (! Pwnd-> pretranslatemessage (& MSG )&&! (MSG. message = wm_char & MSG. wparam = vk_tab) <br/>{< br/> translatemessage (& MSG); <br/> dispatchmessage (& MSG ); <br/>}< br/>}

 

Add wm_lbuttondown, wm_mousemove, and wm_lbuttonup messages to the window handler lresult callback cmainwnd: mainwndproc (hwnd, uint message, wparam, lparam. The slide operation of the ie html page mainly controls the scroll bar dragging by calling the put_scrolltop method of the ihtmlelement2 interface. The Code is as follows:Lresult callback cmainwnd: callback (hwnd, uint message, wparam, lparam) <br/>{< br/> cmainwnd * pmainwnd = (cmainwnd *) getwindowlong (hwnd, gwl_userdata); <br/> hresult hr; <br/> idispatch * Pdisp = NULL; <br/> ihtmlelement2 * pelement = NULL; <br/> ihtmldocument2 * pdocument = NULL; <br/> If (pmainwnd) <br/>{< br/> switch (Message) <br/>{< br/> case wm_lbuttondown: <br/> {<br/> g_moveflag = T Rue; <br/> ylastpos = hiword (lparam); <br/> break; <br/>}< br/> case wm_mousemove: <br/>{< br/> short ypos = hiword (lparam); </P> <p> If (pmainwnd-> _ pbrowser) <br/>{< br/> hR = pmainwnd-> _ pbrowser-> get_document (& Pdisp); <br/> assert (succeeded (HR )); <br/> If (succeeded (HR) <br/>{< br/> hR = Pdisp-> QueryInterface (iid_ihtmldocument2, (void **) & pdocument ); <br/> ihtmldocument3 * pdocument3 = NULL; <br/> hR = Pd ISP-> QueryInterface (iid_ihtmldocument3, (void **) & pdocument3); <br/> ihtmlelement * pbody2 = NULL; <br/> hR = pdocument3-> get_documentelement (& pbody2); <br/> If (succeeded (HR) & pbody2! = NULL) <br/>{< br/> hR = pbody2-> QueryInterface (iid_ihtmlelement2, (void **) & pelement ); <br/> pbody2-> release (); <br/>}< br/> pdocument3-> release (); <br/> pdocument-> release (); <br/> Pdisp-> release (); <br/>}</P> <p> If (g_moveflag = true) <br/>{< br/> If (pelement) <br/>{< br/> long moveTo = ytotal + (ylastpos-ypos ); <br/> printf ("ypos: % d/N", ypos); <br/> printf ("moveTo: % d/N", moveTo ); <br/> pelement-> put_scrolltop (moveTo); <br/>}</P> <p >}< br/> break; <br/>}< br/> case wm_lbuttonup: <br/>{< br/> short ypos = hiword (lparam); <br/> ytotal + = (long) (ylastpos-ypos); <br/> If (ytotal <0) <br/> ytotal = 0; <br/> If (pelement) <br/>{< br/> long scroll_height = 0; <br/> pelement-> get_scrollheight (& scroll_height); <br/> If (ytotal> (scroll_height-IE_WINDOW_H )) <br/> ytotal = scroll_height-IE_WINDOW_H; <br/> pelement-> release (); <br/>}</P> <p> g_moveflag = false; <br/> break; <br/>}< br/> // todo other message <br/>}< br/>

In this way, you can generate a webbrowser that supports slide operations. You can also redesign the UI of the IE Toolbar and add forward, return, and address input boxes. This new IE will appear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.