?
Solved

High Resolution aware on Windows Mobile 6 Professional VGA Emulator/Device

Posted on 2010-01-09
50
Medium Priority
?
2,055 Views
Last Modified: 2013-12-27
Hi Experts,

 I am facing trouble enabling "High Resolution" mode enabled in WM6 Professional. I am using a HTMLView.dll to embed an HTMLControl in our application. By default the "HTML" Shown is not in "High Resolution" Mode - The App is appearing all zoomed up and as how it is displayed in lesser resolution Emulators/devices.(QVGA)

I have already referred to a few links suggested from folks. Most of the links point to http://msdn.microsoft.com/en-us/library/aa454895.aspx

which offers a solution to turn off the Emulation layer in WM6 by adding a line to the resource file.

HI_RES_AWARE CEUX {1} // To turn off the emulation layer

This is because of an accepted bug - discussed at - http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/4d3c837d-16f4-4ae4-acc2-96bb8d573111/

Doing the HI_RES_AWARE didn't help as the view on the HTMLControl was the same. I want to imitate the same functionality that IE Mobile does when I select Menu->View->High Resolution, which does show the HTML the way its supposed to be shown (Smaller - so that more HTML View screen is achieved).

I have already tried to modify the DTM_ZOOMLEVEL which I normally set when an HTML is written to the HTMLControl - This doesn't seem to modify the HTML anyway (set it to least zoom)

Any pointers?
0
Comment
Question by:smokinguns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 26
  • 23
50 Comments
 

Author Comment

by:smokinguns
ID: 26276842
Increase points. Any one ??
0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 750 total points
ID: 26276906
Which SDK you use to compile your application?

If it is Windows Mobile 6, the application will start up with the high-resolution mode and it is not very easy to get it work with the low-resolution. In the project settings in the Linker command should be something like /subsystem:windowsce,4.20 if you use Pocket PC 2003 SDK.

Here is something launching any app in the low mode:
http://handheld.softpedia.com/progDownload/Force-High-Resolution-Download-35631.html

When you create new project for Windows Mobile 6 SDK the studio adds automatically few definitions to the project settings.

If you work with HTML, you can control the image size from it.

http://msdn.microsoft.com/en-us/library/bb278110.aspx

Here is a library (I never tested): http://www.edgelib.com/index.php?node=102

0
 

Author Comment

by:smokinguns
ID: 26277003
pgnatyuk,

  I am using Windows mobile 6 professional SDK to program this.

I have already tried the "Force high def" (through an mui file) but it only helped bring the text size to how it was visible in QVGA (proportionately) . Earlier the HTML was all blown up. Now I want my "HTMLControl" to be High Resolution aware too.

This is my current Linker Option
 /SUBSYSTEM:WINDOWSCE,5.02

I am not using any .NET related code. Is it mandatory to use it, I am currently writing plain 'C' styled HTMLControl. I will try out EdgeLib - But I am still a newbie at using this. Will try and update you here.


0
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26277076
So please tell me you which resolution you need? Your application runs on a Windows Mobile with 640x480 resolution and you need to do what? Make it smaller? Now I'm a bit confused.
0
 

Author Comment

by:smokinguns
ID: 26277151
I am targetting VGA resolution 640X480. When I open the HTML file that i need to load in the HTMLControl - then its zoomed up. But when i select "High Resolution" in IE mobile - Then it becomes smaller (which is what I want in the HTMLControl) - This doesn't seem to happen :(
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26277175
It is default. Check the same on emulators.
I really believe that if you will create new application for Windows Mobile 6.0 and will test it in Windows Mobile 6.1.4, 6.5 emulator, it will work fine.
0
 

Author Comment

by:smokinguns
ID: 26277373
As I mentioned in the original question. the MS guys admit that there is some sort of a bug which auto enables pixelation and they propose adding a new resource item a way to turn it off so that Emulation is off.

This is the link that I am referring to - http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/4d3c837d-16f4-4ae4-acc2-96bb8d573111/
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26277418
It is 2007.
I recommend you to make new test application with only this control and check.
0
 

Author Comment

by:smokinguns
ID: 26292967
I have tried a separate application and added

HI_RES_AWARE CEUX {1}    // turn off the emulation layer

and the looks appear to be the same. Any more pointers on why it won't work ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26293300
Why you are adding something?
Just a simple MFC-dialog (whatever you use) application. No changes at all. You will the default. If it is not what you are looking for - I do not understand your question.
Again - nothing to change, make new MFC dialog-based app.
0
 

Author Comment

by:smokinguns
ID: 26293381
I created a new Win32 Smart Device project and used the wizard to create a non-MFC application. I see the resource file (rc2) and it comes with the following lines.

HI_RES_AWARE CEUX {1}    // turn off the emulation layer
            // Remove this resource to enable pixel-
            // doubling on platforms that support it
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26293514
Ok.
If you have Windows Mobile Emulator 6.1.4 launch this application there.
http://www.microsoft.com/downloads/details.aspx?FamilyId=1A7A6B52-F89E-4354-84CE-5D19C204498A&displaylang=en

http://www.microsoft.com/downloads/details.aspx?familyid=20686A1D-97A8-4F80-BC6A-AE010E085A6E&displaylang=en

You can add somewhere a code detecting the resolution. For example, like that:
CDC* dc = GetDC();
int horzRes = GetDeviceCaps( HDC(dc), HORZRES );
int vertRes = GetDeviceCaps( HDC(dc), VERTRES );

If you will use the emulator with 648x480 screen, you will get the same values from this code above.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26293548
Same:
int horzRes = GetSystemMetrics(SM_CXSCREEN);
int vertRes = GetSystemMetrics(SM_CYSCREEN);

If you use HI_RES_AWARE CEUX {1}, you may need also AfxEnableDRA( true );

http://msdn.microsoft.com/en-us/library/ms838191.aspx
0
 

Author Comment

by:smokinguns
ID: 26293770
Would you happen to know a Non MFC API to enable Application device resolution aware ?


0
 

Author Comment

by:smokinguns
ID: 26293830
So you're saying If i create a Window with the X and Y as higher resolution - It will automatically apply resolution to the Window ? Currently I am getting a full screened window.

Currently I am calculating the Window size as
RECT rc;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);

 x = rc.left;
 y = rc.top;
 width = rc.right - rc.left;
 height = rc.bottom - rc.top;
 
 I Am getting a full screened window within this on WM6. I am not using WM 6.1 but I can try using it if it will make a difference.
 
 Something weird that I observed was that WM6.1 emulator's IE mobile didn't have an option to select "High Resolution"

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26293945
6.1.4 - use this emulator. When you will install these images you will have possibility to choose from many resolutions.
I do not have any 6.0 or 6.1 Windows Mobile device. I have 6.5 with 800x480 and 6.1.x with 400x240 and one with 640x480. I think that even HelloWorld app on 6.5 and 6.1.4 I see this high resolution. It is really tricky to switch these phones to 320x240 or 400x240.

SystemParametereInfo:
http://msdn.microsoft.com/en-us/library/aa932539.aspx

from that link:
On Windows Mobile 6 Standard, the size of the work area returned does not include the menu bar. On Windows Mobile 6 Classic and Windows Mobile 6 Professional, the size of the work area returned includes the menu bar.
0
 

Author Comment

by:smokinguns
ID: 26294005
I am manually resizing the Window after (if) I create the menu bar in my case.

Will try to run the Application on WM 6.1.4 and let you know. Sorry for taking much time to revert back.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26294176
I'm sure on 6.1.4 with 640x480 screen it will work exactly with this resolution.
As you said that was a problem in 2007 with this HTML control, but it was in 2007.
Few months ago I had an opposite problem - in a tricky way we switch the 640x480 device to work in 320x240 mode, but it works only for our process and, for example, a launched from our application IE instance has 640x480.
 
0
 

Author Comment

by:smokinguns
ID: 26294203
I will run my application in

 - Make resource file changes to include HI_RES_AWARE CEUS {1}
 - Run it on WM 6.1.4 VGA (640x480) resolution

Are you aware of any non-MFC API which does the same thing that AfxEnableDRU() does ?
As mentioned in the link, this has to be done to enable High Resolution too.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26294275
Please check yourself. I do not remember. I think, yes, on Windows Mobile 6.1.4 phones this mode is default and you will have it even in non-MFC application. I'm almost sure that it is true for my HTC phones.


0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26294317
Let me know if you need a code. It can be even the simplest application - choose empty project in the wizard, add one cpp-file and add these lines:
int horzRes = GetSystemMetrics(SM_CXSCREEN);
int vertRes = GetSystemMetrics(SM_CYSCREEN);

or:

HDC hDC = GetDC(NULL);
int width = GetDeviceCaps(hDC, HORZRES );
int height = GetDeviceCaps( hDC, VERTRES );
0
 

Author Comment

by:smokinguns
ID: 26294409
I Am good with the code. Will report back what is being printed in these int variables in the case of my application (which is run through another EXE)

And a plain simple application.
0
 

Author Comment

by:smokinguns
ID: 26321686
Hey,
 I tried getting the width and height for my case as suggested by you. I am getting 480 X 640. Now how shall i use this information to display the html page? Shall i use this for placing my html while calling CreateWindow method?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26323895
I think, yes.
I do not see the entire program to give a more specific answer.

0
 

Author Comment

by:smokinguns
ID: 26347478
Hi,
I have used the following code for setting html :
first I CreateWindow :

HDC hDC = GetDC(hWnd);
    int width = GetDeviceCaps(hDC, HORZRES );
    int height = GetDeviceCaps(hDC, VERTRES );

    hWnd = CreateWindow(WC_HTML, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, width,height, NULL, NULL, hInstance, NULL);


char * htmlString = "<html> dhjsh </html>"
setHTML(hWnd, htmlString);


Then , setHTML() as following :

int setHTML(HWND hWnd, const char* htmlString) {

    int    numChars = strlen(htmlString);

    //Prepare a wide char string
    BSTR wideString = SysAllocStringLen(NULL, numChars);
    int chars = MultiByteToWideChar(CP_ACP, 0, (LPCSTR) htmlString, numChars, wideString, numChars);

    // Enable Scripting
    SendMessage(hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)TRUE);

    // Specify the zoom level. 4 is the largest.
      SendMessage(hWnd, DTM_ZOOMLEVEL, 0, 0);

    //Set the passed in HTML string
    SendMessage(hWnd, DTM_ADDTEXTW, FALSE, (LPARAM) wideString);

    //Mark the end of html document
    SendMessage(hWnd, DTM_ENDOFSOURCE, 0, 0);

        return 0;
}


But i am unable to get the high resolution mode as IE mobile. zoom level does reduces the size but not as less as the IE mobile high resolution mode does.

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26347560
But I do not see that you create the full-screen window. it shoudl be popup and should cover the whole sceen from 0, 0, with, height. I do not know this WC_HTML style and I can be wrong.
For a test purpose put there another test window and draw few rectangles there to check that this window has correct resolution. So we will understand where is the problem
 
0
 

Author Comment

by:smokinguns
ID: 26348483
We're creating a full screen window based on the height and width of the screen (the values are 640 X 480)

When we calculate the width and height using - they are 480X588 (Reduced due to Window title bar)

WC_HTML is the Window style available in htmlctrl.h

#define DISPLAYCLASS    TEXT("DISPLAYCLASS")
#define WC_HTML         DISPLAYCLASS

Will try out the rectangle draw approach and post the results.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26348783
I've said - WS_POPUP window may cover the entire screen including the title bar.
WC_HTML is the window class name.
Use just a trivial window like in any Hello, World! example.

But even in your case you see the correct resolution. So, I think, the resolution change you see comes from the html-pages you are showing in your controls.


0
 

Author Comment

by:smokinguns
ID: 26349704
Hey,
I tried as sugested by you, created a basic example which displays the rectangle, but how do i figure out that  its the correct resolution ? I am attaching the screenshot of the way i am getting and the way i am expecting.

expectedResolution.jpg
howitcomes.jpg
0
 

Author Comment

by:smokinguns
ID: 26350098
I am uploading another image which shows the rectangle when the width and height are 400x500



Rectangle-400By500.jpg
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26351687
If you have created a full-screen window, call GetWindowRect to get the window size, you will know the resolution.
I think the problem comes from the HTML and not from your C++ code. Check the HTML. Another option is the HTML control you are using and I do not know if it supports 640x480 resolution.
 
0
 

Author Comment

by:smokinguns
ID: 26351716
When you say that the problem comes from the HTML - If the HTMLControl believes its runs in a High resolution mode - Then the display is rendered appropriately - As how one can see in the IE mobile screen shot above.

My question right from the beginning was the same on how to use htmlview.dll on High resolution too.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26352207
I see your question in MSDN:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/5a3e4555-73ed-4a74-8529-faefd8c7a158
This is a window. If you create it as 480x640 size and you see the window correctly, it works. What you show in this window and how - this is another question. I said it few times already - check the HTML you are displaying in this control.
 
0
 

Author Comment

by:smokinguns
ID: 26352381
I know that HTML input boxes width is higher and wouldn't look well on QVGA.
But this HTML fits well in the "high resolution" mode of IE mobile (VGA).
I m trying to have my web browser control accommodate it in the same way.

I have tried to reduce the HTML input box sizes, but the text was by default appearing big.

I sense there is this "high resolution" issue that's missed out and that's why the page appears this way.
0
 

Author Comment

by:smokinguns
ID: 26357295
Hey,

I tried using the following meta tag in my html file.
<meta name="MobileOptimized" content="480">
However, there was no change in the html loaded by my app, but it did have change when i loaded it in the IE. I am attaching the screenshot

noMetaTag.jpg
metaTag.jpg
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26361180
What do you mean "correct resolution"?
I think you mean that:
int horzRes = GetSystemMetrics(SM_CXSCREEN);
int vertRes = GetSystemMetrics(SM_CYSCREEN);

http://msdn.microsoft.com/en-us/library/ms929469.aspx

This function retrieves the dimensions — widths and heights — of Windows display elements and system configuration settings. All dimensions retrieved by GetSystemMetrics are in pixels.
0
 

Author Comment

by:smokinguns
ID: 26361354
when I mean't by correct resolution - I mean't how the webpage would look if shown on a machine (mobile here) with 640X480 resolution without any zooming in.

We're using different ways to create a window - all of them correspond to our required resolution i.e 640x480.
0
 

Author Comment

by:smokinguns
ID: 26425078
hi,

I tried finding the screen width and height by using a javascript in the html page which i am getting displayed by using the htmlView.dll. And to my surprise, it shows screen size as 240X320. This is the root cause of the entire zoomed up boxes and text. Do you have any idea that how can I bring this screen size to 480 X640 VGA size?  I also tried the same javascript from IE. IE too displays the QVGA screen size. But if i activate the high resolution mode, it gives VGA screen size. And I could not find much details on how is IE doing that.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26426198
I tried to explain it for you from the beginning.
I do not know how change it. Maybe an update of you Windows Mobile image, because it is somewhere in the system DLLs.
 
0
 

Author Comment

by:smokinguns
ID: 26453791
Hi,

Can anyone suggest me that how can we set the default resolution for html control window .
Even if the application window is of higher resolution, html control always renders html pages in 240 X 320 screen size. Can someone suggest that how can this be changed?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26457796
Maybe you will have to develop an own control. I do not know.
This article says how to retrieve the content from an HTML:
http://blogs.technet.com/suvarnas/archive/2006/01/13/417387.aspx

Here is a  famous EE article:   http://www.experts-exchange.com/articles/Programming/System/Windows__Programming/Browser-Bot-Automate-Browsing-Sequences-With-C-PART-TWO.html

I think, I remember something about the resolution can be set in HTML.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26457825
Check the attached file. Pay attention on:
width: 100%;
 height: 100%;
 

sample.txt
0
 

Author Comment

by:smokinguns
ID: 27463647
The JS width is being reported as 480/2 instead of 480. So the browser only sees it as 100% i.e 240.

Although the issue remains. I would like to award the points to @pgnatyuk for trying and giving pointers to try on.

We're meanwhile trying hard to fit our HTMLs to look better on 320X240.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 27464696
I do not understand you. If the answer was not found, why you put my comment as the accepted solution? If it is a solution, why you set it as Grade C?
I'd propose to you to add your own comment and mark it as an accepted solution with any grade.
0
 

Author Comment

by:smokinguns
ID: 27465178
@pgnatyuk - This is not a solution and didn't want to refund/delete the question. If you donot wish to have the Grade. Let me know - I will revert it.

But this is not a solution. I still wanted to award the points to you for trying to help me.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 27465743
I really do not want to see Grade C in the list of my answered questions.

BTW, we have solved exactly the same issue for our commercial project. The application works with 400x240 resolution on HTC Touch Pro 2 and the IE window launched from this application (a request for an image)  always has 800x480. We have two solutions and both are in the logic - we set the image size as 800x480 and so it is shown correctly. the second solution - to download the image and show it in an own window.
0
 

Author Comment

by:smokinguns
ID: 27467646
@pgnatyuk - I'll check if the grade can be changed

Here the only way this could be different from what you achieved was that we're using a IE Browser control instead of a widget based application which has VB type of widget constructed. Correct me if I am wrong.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 27471380
>>I'll check if the grade can be changed
Press "Request attention" and ask to re-open the question. Then you can close it again.

How can I change a grade?
http://www.experts-exchange.com/help.jsp#hs=29&hi=404

What's the right grade to give?
http://www.experts-exchange.com/help.jsp#hs=29&hi=403

 
0
 

Author Closing Comment

by:smokinguns
ID: 31675116
Closing the question.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question