MFC dialogboxes - keeping window focus

Started by
0 comments, last by bschwagg 19 years, 8 months ago
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
cha cha cha
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?
cha cha cha

This topic is closed to new replies.

Advertisement