views:

449

answers:

2

We have an application that downloads some files in the background. Our application pops up when an Internet connection is made, and after prompting the user to accept the downloads, we'd like to switch back to the home screen while we do our stuff.

We can't work out how to do to this. We can emulate pressing "back" a few times, which sometimes works, but where you end up depends on what the user was doing when the Internet connection happened.

So, can someone provide pointers to how to do this?

Thanks.

Paul.

+1  A: 

Can you try setting the today screen as the foreground window?

HWND hWnd = FindWindow(_T("DesktopExplorerWindow"), _T("Desktop")); SetForegroundWindow(hWnd);

Snailslug
We tried this - couldn't find a matching window :(
Paul
Using Remote Spy to look at windows mobile 5 smartphone, it looks like the desktop doesn't have a Window name whereas pocket pc does. Could you try: HWND hWnd = FindWindow(_T("DesktopExplorerWindow"), NULL);
Snailslug
Bingo. That worked. Thanks very much.
Paul
No problem! Glad it worked.
Snailslug
+1  A: 

Why don't you simply hide your app?

Using a Notification shell object instead of popping up a full screen window might be a better alternative. Details here.

Serge - appTranslator
Interesting idea. The customer has requested this behaviour, but we could go back and ask if they'd accept notifications
Paul
According to that link, it only works on PocketPCs. We need to support Smartphones too :(
Paul
Oh! :-( I must say I never tried it on SmartPhones
Serge - appTranslator