From: Jack on
Hi,

I have a fullscreen dialog based app and *almost* have the "one instance
only" stuff working - with one caveat..

Say I have my app showing either a pop-up dialog or a messagebox. The user
then decides to navigate top the home screen.

The app disappears as expected. He then reactivates the app by clicking on
its icon. It is reactivated but just shows the base dialog, the popup or
messagebox is not shown. It's still there as it blocking the keyboard
interface to the base dialog.

Also after around 30-60 seconds the popup or messagebox reappears.

What do I need to do to get any child dialog or message box to come to the
foregound and gain focus when the app is reactivated?

TIA.


From: dbgrick on
One method is to hold a reference to the top most form. Then when your main
form is activated, check if there is another topmost form and show it.

Regards,
Rick D.

"Jack" wrote:

> Hi,
>
> I have a fullscreen dialog based app and *almost* have the "one instance
> only" stuff working - with one caveat..
>
> Say I have my app showing either a pop-up dialog or a messagebox. The user
> then decides to navigate top the home screen.
>
> The app disappears as expected. He then reactivates the app by clicking on
> its icon. It is reactivated but just shows the base dialog, the popup or
> messagebox is not shown. It's still there as it blocking the keyboard
> interface to the base dialog.
>
> Also after around 30-60 seconds the popup or messagebox reappears.
>
> What do I need to do to get any child dialog or message box to come to the
> foregound and gain focus when the app is reactivated?
>
> TIA.
>
>
>
From: Jack on

"dbgrick" <dbgrick(a)discussions.microsoft.com> wrote in message
news:9FF97D4F-6EA1-47E9-AACF-37BE4C2A6B18(a)microsoft.com...
> One method is to hold a reference to the top most form. Then when your
> main
> form is activated, check if there is another topmost form and show it.
>
> Regards,
> Rick D.
>

Hi Rick,

What about if a messagebox is displayed?

Also if their is a hierarchy of dialogboxes would I need to go through
displaying the hierarchy in turn?

EG I have my dialog which pops up a listview which pops up another dialog.

Cheers.






> "Jack" wrote:
>
>> Hi,
>>
>> I have a fullscreen dialog based app and *almost* have the "one instance
>> only" stuff working - with one caveat..
>>
>> Say I have my app showing either a pop-up dialog or a messagebox. The
>> user
>> then decides to navigate top the home screen.
>>
>> The app disappears as expected. He then reactivates the app by clicking
>> on
>> its icon. It is reactivated but just shows the base dialog, the popup or
>> messagebox is not shown. It's still there as it blocking the keyboard
>> interface to the base dialog.
>>
>> Also after around 30-60 seconds the popup or messagebox reappears.
>>
>> What do I need to do to get any child dialog or message box to come to
>> the
>> foregound and gain focus when the app is reactivated?
>>
>> TIA.
>>
>>
>>


From: Jack on

"dbgrick" <dbgrick(a)discussions.microsoft.com> wrote in message
news:9FF97D4F-6EA1-47E9-AACF-37BE4C2A6B18(a)microsoft.com...
> One method is to hold a reference to the top most form. Then when your
> main
> form is activated, check if there is another topmost form and show it.
>
> Regards,
> Rick D.


Also, whats the story about the OS bringing the app orward after a certain
period of time without any intervention by my app?

Presumably some sort of messaging is going on, but what? And can I instigate
it to do the same on demand?

Cheers all.





> "Jack" wrote:
>
>> Hi,
>>
>> I have a fullscreen dialog based app and *almost* have the "one instance
>> only" stuff working - with one caveat..
>>
>> Say I have my app showing either a pop-up dialog or a messagebox. The
>> user
>> then decides to navigate top the home screen.
>>
>> The app disappears as expected. He then reactivates the app by clicking
>> on
>> its icon. It is reactivated but just shows the base dialog, the popup or
>> messagebox is not shown. It's still there as it blocking the keyboard
>> interface to the base dialog.
>>
>> Also after around 30-60 seconds the popup or messagebox reappears.
>>
>> What do I need to do to get any child dialog or message box to come to
>> the
>> foregound and gain focus when the app is reactivated?
>>
>> TIA.
>>
>>
>>


From: Scott Seligman on
"Jack" <notaround(a)dontmail.com> wrote:
>Hi,
>
>I have a fullscreen dialog based app and *almost* have the "one instance
>only" stuff working - with one caveat..
>
>Say I have my app showing either a pop-up dialog or a messagebox. The user
>then decides to navigate top the home screen.
>
>The app disappears as expected. He then reactivates the app by clicking on
>its icon. It is reactivated but just shows the base dialog, the popup or
>messagebox is not shown. It's still there as it blocking the keyboard
>interface to the base dialog.
>
>Also after around 30-60 seconds the popup or messagebox reappears.
>
>What do I need to do to get any child dialog or message box to come to the
>foregound and gain focus when the app is reactivated?

You can try using this trick to bring the child window to the front:

// set focus to foremost child window
// The "| 0x00000001" is used to bring any owned windows to
// the foreground and
// activate them.
SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));


--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
They who would give up an essential liberty for temporary security,
deserve neither liberty or security.
-- Ben Franklin