Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus in a form
Message
General information
Forum:
Visual C++
Category:
Microsoft Foundation Classes
Miscellaneous
Thread ID:
00740711
Message ID:
00741325
Views:
14
The dialog window is not created before dlg.DoModal() and handle m_hWnd is not valid, so you'll alway get an assert before DoModal(). Try to place SetActiveWindow() or SetFocus() into OnInitDialog(). You could also try to destroy splash screen instead of hiding.

Alexander

>Hi Alexander, thanks for you response
>
>well, here is the code:
>
> // show splash screen for settings all stuff
> CSplashThread* pSplashThread = (CSplashThread*) AfxBeginThread(RUNTIME_CLASS(CSplashThread), THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
> if (pSplashThread == NULL)
> {
> AfxMessageBox(_T("No se pudo crear pantalla de inicio"), MB_OK | MB_ICONSTOP);
> return FALSE;
> }
> ASSERT(pSplashThread->IsKindOf(RUNTIME_CLASS(CSplashThread)));
> obizconfig obizconfigxml;
> if (!obizconfigxml.Load_XML_Document("config.xml"))
> {
> obizconfigxml.setnewconfig("config.xml");
> obizconfigxml.Load_XML_Document("config.xml");
> }
> CString cbitmap = getsplashscreen();
> pSplashThread->SetBitmapToUse( _T(cbitmap) );
> pSplashThread->ResumeThread(); //Resume the thread now that we have set it up
> Sleep(500);
> pSplashThread->HideSplash(); // ocultamos el splash una vez finalizado el setup
> CObizloginDlg dlg;
> dlg.SetActiveWindow(); <------------------ here try to do your tip
> //dlg.SetWindowPos(HWND_TOP);
> //BringWindowToTop(dlg.m_hWnd);
> //SetWindowPos(dlg.m_hWnd,HWND_TOP);
> //dlg.SendMessage(BringWindowToTop);
> //dlg.GetActiveWindow();
> //SetFocus(dlg.m_hWnd);
> //ShowWindow(dlg.m_hWnd, SW_SHOWNORMAL);
> //m_pMainWnd = &dlg;
> //dlg.m_hWnd->SetFocus();
> //SetFocus(dlg.m_hWnd);
> //dlg.setCOMregisteruser(configX.getCOMregisteruser());
> int nResponse = dlg.DoModal();
>
>but i obtain an assert error
>
>thanks for your help
>
>Best Regards
>
>Francisco Morosini
Previous
Reply
Map
View

Click here to load this message in the networking platform