From: Jack on

"Scott Seligman" <seligman(a)example.com> wrote in message
news:ftol08$kcq$1(a)panix3.panix.com...
> "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));
>

Nope, doesn't work.


From: Jack on

"Scott Seligman" <seligman(a)example.com> wrote in message
news:ftol08$kcq$1(a)panix3.panix.com...
> "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));
>

Nope, doesn't work.



From: Chris Tacke, eMVP on
When you go to activate the existing instance, you might post a WM_ACTIVATE
to it and see if that brings the proper child to the fore. Just a guess, but
worth a try.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"Jack" <notaround(a)dontmail.com> wrote in message
news:LbmdnQBIMryqrJvVnZ2dnUVZ8uudnZ2d(a)pipex.net...
>
> "Scott Seligman" <seligman(a)example.com> wrote in message
> news:ftol08$kcq$1(a)panix3.panix.com...
>> "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));
>>
>
> Nope, doesn't work.
>


From: Jack on


> When you go to activate the existing instance, you might post a
> WM_ACTIVATE to it and see if that brings the proper child to the fore.
> Just a guess, but worth a try.

It already receives a WM_ACTIVATE .

When I receive it I bring the base dialog to the fore and it works OK. I
think if I keep a reference of any active popup dialogs
as suggested then that will work OK too I think - don't see why not. But how
about if the user switches away when a Messagebox is displayed?

When I reactivate the app the messagebox is there as it has the kb focus -
but it isn't displayed.

Somehow the OS manages to do it as after a minute or so the messagebox or
whatever is brought to the fore even if I have not added any code to do so.




> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
> "Jack" <notaround(a)dontmail.com> wrote in message
> news:LbmdnQBIMryqrJvVnZ2dnUVZ8uudnZ2d(a)pipex.net...
>>
>> "Scott Seligman" <seligman(a)example.com> wrote in message
>> news:ftol08$kcq$1(a)panix3.panix.com...
>>> "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));
>>>
>>
>> Nope, doesn't work.
>>
>
>