how to show my window derived from CWnd
-
i want to show my window which is derived from CWnd in the button clicked event .the following is my code void CTmp_dlgDlg::OnButton1() { RECT rect; CString str; GetWindowRect(&rect); CMyWnd *mywnd = new CMyWnd; str = AfxRegisterWndClass( 0); int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234); mywnd->ShowWindow (SW_SHOW); } CMyWnd::CWnd but i can't show the window,why? gucy
-
i want to show my window which is derived from CWnd in the button clicked event .the following is my code void CTmp_dlgDlg::OnButton1() { RECT rect; CString str; GetWindowRect(&rect); CMyWnd *mywnd = new CMyWnd; str = AfxRegisterWndClass( 0); int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234); mywnd->ShowWindow (SW_SHOW); } CMyWnd::CWnd but i can't show the window,why? gucy
Try
void CTmp_dlgDlg::OnButton1()
{
RECT rect;
CString str;
GetWindowRect(&rect);
ScreenToClient(&rect); // new line here !!!
CMyWnd *mywnd = new CMyWnd;
str = AfxRegisterWndClass( 0);
int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234);
mywnd->ShowWindow (SW_SHOW);
} -
Try
void CTmp_dlgDlg::OnButton1()
{
RECT rect;
CString str;
GetWindowRect(&rect);
ScreenToClient(&rect); // new line here !!!
CMyWnd *mywnd = new CMyWnd;
str = AfxRegisterWndClass( 0);
int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234);
mywnd->ShowWindow (SW_SHOW);
} -
How
CMyWnd
looks like? I made a test wich draws a line onWM_PAINT
and worked just fine. rechi -
the app the a dialog based app. i clicked the button on the dialog. nothing changed. i think it would have pop out a window. Can i mail the source to you? gucy