Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ShowWindow(SW_NOACTIVATE) in CDialog Application

77 views
Skip to first unread message

Bruce K.

unread,
May 20, 2009, 10:01:02 AM5/20/09
to
With advice from this forum, I need to make an CDialog application launch,
but not take focus. It was suggested I use the function
ShowWindow(SW_NOACTIVATE), but since I'm using CDialog I'm unsure how change
the way this class intially displays the window.

Bruce K.

Scot T Brennecke

unread,
May 21, 2009, 1:08:53 AM5/21/09
to
Here's an example:
http://www.codeproject.com/KB/system/onscreenkeyboardframework.aspx?display=PrintAll

"Bruce K." <Bru...@discussions.microsoft.com> wrote in message
news:CC0D4E88-D333-448B...@microsoft.com...

prash

unread,
May 21, 2009, 1:55:20 PM5/21/09
to

"Bruce K." <Bru...@discussions.microsoft.com> wrote in message
news:CC0D4E88-D333-448B...@microsoft.com...

In reply to your previous post, Doug Harrison had suggested using
WS_EX_NOACTIVATE ex-style to create the main dialog for your secondary app.

In OnInitDialog() of the secondary app, just call 'ModifyStyleEx' with
WS_EX_NOACTIVATE as the style to add. As simple as that.

However, note that WS_EX_NOACTIVATE style is defined only if the symbol
_WIN32_WINNT is defined to be >= 0x0500 for your project i.e. if you are
targeting your app for Win2K or a newer OS. Otherwise, you'll get a compiler
error and you'll have to go about fixing the symbol definitions.

As I said before, this is a much easier way to go about writing the code for
what you want to achieve.

With that said, I would just like to add that in case the above method does
not work (for whatever reason), you can always use the method suggested
earlier i.e. using WaitForInputIdle, BringWindowToTop and
SetForegroundWindow in your primary app after the call to CreateProcess.

Both these methods work!

- Prashant


0 new messages