• Advertisement
Sign in to follow this  

MFC dialogboxes - keeping window focus

This topic is 4949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi- I'm trying to use CDialog's to have users register when they use my company's software. The program is an excel add-in, inside a DLL. When the software first tries to access the DLL, the dialogboxes are displayed. However, there is a problem; when one dialogbox gets closed and another is opened, the focus jumps to the next active window then comes back. It produces a nasty flashing effect or sometimes puts the program in the background. I've been working on this two days straight with no luck! Example Let's say I was going to ask for the license key.. void RegDialog::OnEnterkey() { this->ShowWindow(SW_HIDE); AFX_MANAGE_STATE(AfxGetStaticModuleState()); KeyDialog keyDialog(GetParent(), ptr_User); keyDialog.DoModal(); if(VerifyKey()){ EndDialog(1); return; } this->ShowWindow(SW_SHOW); } //------------------------------------------- This code would flash on ShowWindow(SW_HIDE) I've tried using GotoDlgCtrl(...) to change where which window is active, but it didn't work. I've tried making an invisible main CDialog and creating all the others off of that, no luck there either. For now I'm making all my dialogs using the handle, AfxGetMainWnd() so that hopefully it would put control back to the main window. nothing works : ( Has anyone seen anything similar to this or have any ideas?? Anything would be appreciated! Brad

Share this post


Link to post
Share on other sites
Advertisement
I've also tried to modify the WS_VISIBLE property in the window but this just messes up all the window behavior. Any ideas?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement