Intermittent pausing in a dialog-based application - Windows Mobile Development and Hacking General

I have a program called Fred (names have been changed to protect the innocent) which I created in embedded Visual C++ 3.0 targetted for the Pocket PC 2002 platform.
The main dialog is a blank dialog - that is, it contains no controls.
When Fred starts, it shows this dialog for a split second, then executes what I call a Dialog Driver. This is simply some code that decides in what order to show other dialogs.
This driver shows the first dialog proper - the entry screen for the application with various option buttons. Depending on what button the user presses, they are taken through a series of dialogs, entering information as they go.
It is the dialog driver's responsibility to show the correct dialog, let it dismiss itself, then display the next one, so that there are at most two dialogs in existence at one time (the blank dialog and the one the user sees). This is opposed to the other traditional method of making each dialog itself display the next dialog in the sequence, with potentially tens of dialogs all laid on top of each other.
Here is the thing: on the XDA I, Fred works seamlessly. You always get a split-second pause between dismissing one dialog and showing the next. In this split second, you see the underlying blank dialog and the user thinks nothing of it.
On the XDA II however, the pause still occurs between one dialog and the next, but this time it sometimes lasts significantly longer. We're talking several seconds of seeing the blank dialog and there is no pattern to when this occurs.
On one occasion, we spent 4 minutes staring at the blank dialog, waiting for Fred to display the next dialog and in the end decided to interrupt it by tapping the Start button. This magically displayed the next dialog's contents with the Start menu on top, making everything alright again.
Right, I've rambled on for long enough. You probably stopped reading hours ago. If anyone has experienced similar problems or have any idea why this might be happening, I would be very grateful to hear from you.
Specs:
Fred is an embedded Visual C++ 3.0 program targetted for Pocket PC 2002, running on an O2 XDA II running Windows Mobile 2003.

Related

Putting PPC (Harrier & iMate) app on Treo 700wx Issues

Hi,
I have an application which has been running nicely on Harrier and iMate devices, well any PPC devices really because of their rectangular screen shape.
My client has gone and bought some Palm Treo 700wx devices, and they have a smaller square screen.
In the resource of my project the screens are designed to fit PPC. When it runs on the Treo the Treo automatically pops up a scroll bar to allow the whole view to be seen.
The issue is when I first go into the app I can't see the top of the screen, about 20 odd pixels heigh aren't displayed. The scroll bar still displays and I can scroll down to the bottom of the view, and when I scroll up again the top of the screen is still out of sight.
If I exit the app just by tapping on the x in the top right corner (so the app is still running, not exiting properly via my Exit button which shuts down the app), I exit the app and then when I go back into the app the screens are displayed correctly, there is no missing space at the top of the screen.
If I exit the app via my exit button and then start the app again, the top of the view is missing again.
Does anyone know why the screen isn't displayed correctly when I first enter the app, or why it should come right when reloading the view again? Has anyone else had problems with screen layout when putting PPC apps on the square Treo 700wx?
Thanks
It sounds like you have a 'refresh' problem. I haven't encountered this my self and it is really hard to diagnose when you don't even tell us what language your app is written in, but basically here is what I think happens:
When your app is launched, part of its window doesn't get properly painted (not sure why exactly).
When you click the X the app isn't closed, but minimized.
When you return to it the window is maximized and repainted. Second repaint goes correctly.
The quick solution to this would be to force a window refresh just after the app is fully started.
Sorry I forgot to add the language.. it's written in eVC++ 3.0
I'll give the refresh a go, thanks
Further Questions..
I thought that minimising and then maximising the screen fixed the problem, but only partially..
Because the screen in resource is designed for regular PPC it is bigger than the Treo 700 screen size, so the OS automatically shows a scroll bar.
The new issue I'm seeing is to do with the scroll bar. The steps I take to reproduce the issue are:
1. Go to View1, and I scroll down the view (I'm using CView not CDialog)
2. Go to View2
3. Go back to View1. When I go back to the first view the scrollbar is scrolled down in the position I left it.
4. Scroll up to top of view and some of the controls in the wrong place. Some controls I dynamically create in OnInitialUpdate, and as part of the Create() I pass in CRect to tell it where to create the control.
If I set CRect.top to say 10, it's created 10 down from the top of the visible screen. The problem is that because I've scrolled the view previously the view draws it 10 down on the visible portion of the view.
I had thought that the easiest solution would be to always reset the scroll bar to the top of the view before creating my controls, but I'm not sure how to force the OS scroll bar to the top of the view. I've tried SetScrollPos(0,0) or ScrollWindow(0, y). ScrollWindow moves the actual view up or down, but the OS scrollbar is still in the same position.
Any ideas on how to set my view window to the top and to reset the scrollbar?
Thanks again
How to refresh a view?
I have sorted the issue mentioned just above, by finding the scroll position and factoring in that when I set the value of CRect area of the controls I need to dynamically draw.
I'm now just left with the first issue, of when I first start up the app the top part of the window and scrollbar are covered by the Title/Taskbar at the top of the screen.
If I close the app via the x button and restart the app, the issue resolves itself. Or if I open up any dlg like the About screen or even display an AfxMessageBox, when I close the dialog the original screen is redrawn correctly, in the correct position and scroll bar fully shown.
I have tried calling RecalcLayout(), RefreshWindow(), UpdateWindow(), Sending WM_SIZE messages and a whole range of things, but I can't seem to get the screen refreshing correctly apart from when I open any dialog and close that dialog.
When you close a dialog what messages get sent to the previous view that force it to redraw? Does anyone have any suggestions how I can force a refresh myself?
Thanks again
Did you try InvalidateRect?
I am getting a bit rusty with MFC, since I now try to do things the hard way and use pure win 32, but this should work.
If you can't use it as a class member, call the API directly using you view GetSafeHwnd() function for window handle). Use NULL for lpRect to redraw the whole window and FALSE for bErase to prevent flickering.
Note that UpdateWindow() only triggers repaint if part of the window becomes invalid (the contents needs redrawing).
No I hadn't thought of using InvalidateRect(), so I should give it a go.
In the end I just wanted the issue fixed so opted for a quick 'n dirty solution of displaying a temp CDialog as soon as the app starts and calling EndDialog() immediately in the OnInitDialog() so the dialog disappears before you see it.
It worked and the original screen gets updated to correct size, layout and scroll bar.
Cheers.

Misc .NET CF questions

Hello, I'm thinking about switching over from my Palm OS Treo 700p to a Sprint Mogul and would like to develop some apps using .NET. I'm a long-time VB developer (VB3 thru VB6) but a more recent newbie with .NET (focusing on C#). I've also had experience with several Pocket PC / WM devices and dabbled with eVB long ago (hated it). Anyways, I've got some ideas for apps/applets/hacks that I'd like to create for WM devices (and the Mogul specifically), but I'm not sure what's possible with WM6 and .NET, so some questions:
1) Let's say I wanted to create an app that "runs in the background" all the time. I'm fairly certain that I can create an app that gets started after a soft reset but doesn't show any visual signs of being started. I want this app to essentially "listen" for other events. So, if for example, I'm using IE and the user presses a specific hard button, I want my app to trap that before IE notices it. My app might then fire up a window which displays on the screen.
a) Can I do this?
b) Can I trap *any* button (including the Start button, the OK button, and the two "soft menu" buttons?
c) Can I distinguish between a regular button press and a "press and hold"?
2) Can I effectively "replace" some/all of the built-in phone functionality? For example, when a call comes in, instead of the built in phone functionality taking over and showing on-screen an answer/ignore window, could I create an alternative app that had answer/ignore buttons?
3) What are my options for displaying windows on top of other apps?
a) Can I have a small window display on top of other running apps?
b) Can I do something fancy like have my app display a translucent full-screen window on top of a running app?
Thank you for any help you can offer.
Scott
all those things are possible but I think you had better use c++ especially for the phone stuff.
for the button pushes, the problem is that other programs can change it after you start up. Because the user will not see you app they will not know it happened.
There is not a good way to replace the phone answer dialog but you can just stop it and put up your own, you will need to be careful to prevent any uncontrolled ringing or vibrating that can be left when stopping the phone. If you are using c# to know when the phone is rinning you will not catch it fast enough to prevent the phone app rinning before your one.
You can put windows on top of other windows but you will then have to make sure the ok/x is correct. Its very easy to screw up the os smart minimize so that it no longer corresponds to the window the user sees. Maybe it would be better to just subclass the window you want to cover and make it look like you want.

MessageBox gets lost

Hello,
I write software for WinMobile and own HTC HD2.
When I create a MessageBox (System.Windows.Forms.MessageBox) i can see it, but at the moment I switch to another application (without pressing "OK") the MessageBox goes to the background and never pops back.
the windows of the messagebox appears in process list (and cannot be killed since this is not listed in the application list) and if the MessageBox is the first to show, then the only way to kill this is by soft-resetting the device.
would be happy to know if anyone knows for a way to address this.
thanks
just out of interest, when the window is lost, try switching to airplane mode, see if it comes to the front...

Window Transitions/Animation

I guess the question has come up already a dozen of times, but I wasn't able to find any relevant previous threads so here it goes...
I've read several times already it is impossible to add window animations to WM (6.5) .
However, when I open an email from the default MS email app that comes on my HTC Touch2 with default ROM, it clearly fades to the new email window. Even the closing "X" in the top right corner fades to an "ok" icon.
How is this possible?
Also, this app: (CRT fade out Animation)
http://forum.xda-developers.com/showthread.php?t=843480
clearly applies effects to the screen image.
Someone please clear things out :/
It is possible quite easily, if you know where to search. I'd go on this with the same way I did my pinch to zoom project some time ago - hacking the app's WndProc and when message for eg swipe gesture to change message comes, grab screen content, fade it, send the message through, fade in and all other messages meanwhile just normally send through.
But remember, this takes a lot of code and it is not worth it, it would just slow down the WM itself.
Thanks, a lot, for replying.
I really want to look into this for some reason. So if you say it's possible...
I was also wondering if it's possible to catch all windows' close events...

Android Wear APP Showing White Screen Above Activity at Startup and Resume

Android wear: white screen above activity at start up + when resume
Hello,
I'm having a strange behaviour with my android wear app. My app structure is basically: a loading activity that starts another activity which contains 4 fragments and the user can slide between those fragments.
The strange behaviour happens randomly but with the same pattern: a white screen appears "above" my activity/fragment and I have to dismiss it (android wear style: swiping on the left) to access my activity/fragment. This happens either on first start up of the app or after I clicked on the physical button of the watch and resume the app by clicking back on its icon in the app's list of the wear.
What I tried already is the following:
I put breakpoints on the onCreate of Activity and Fragment, but the debugger does not stop on it when this white screen appears. I concluded that this white screen is neither an activity nor a fragment.
I also removed all the "pop up" elements such as Toast and so, which I first thought were the root cause of my problem.
I also tried to follow the different advices of "how to remove white screen at start up" (such as putting in the manifest "@android:style/Theme.Translucent.NoTitleBar.Fullscreen", setting the "android:windowBackground" to another color and so) but it didn't resolve my problem.
I also looked up for post on stack overflow (the closest I found is this one: Pressing home button on Android - white screen when resuming app) but I didn't find any solution yet.
My problem happens both on emulator and real wear device (I'm using a moto 360).
Has somebody else experienced the same problem? Anybody has an idea where I could look further?
Thank you a lot in advance for your help, I'm really stuck and don't know what else to do.
Best,
Jenny

Categories

Resources