ورود

View Full Version : framewnd in dialog



mochenoo
یک شنبه 25 بهمن 1388, 15:19 عصر
با سلام


من یک برنامه SDI ساختم ولی در InitInstance کدهای موجود را حذف می کنم:




CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMyView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
ProcessShellCommand(cmdInfo);
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

و یک Dialog می سازم:




CMyDialog dlg;
dlg.DoModal();



سپس کدهای حذف شده را درون یک تابع(مثلا runframe) در همان کلاس CMyApp قرار می دهم و با زدن یک buttton در dialog این تابع را احضار می کنم:



CMyApp* asd=new CMyApp;
asd->runframe();


البته در کلاس CMainFrame و در تابع PreCreateWindow کد زیر را اضافه می کنم:



cs.style=WS_POPUP | WS_VISIBLE;


با این کار من در یک dialog، یک برنامه sdi دارم. ولی Status Bar از کار می افتد. به طوریکه روشن و خاموش شدن Num Lock را فقط در لحظه ایجاد و یا باز کردن فایل می فهمد.

چگونه باید این را حل کنم؟

و یا راه بهتری برای این منظور وجود دارد؟