设计时,可以修改其属性Visible=false;运行时,可以这样子:ShowWindow: BOOL ShowWindow( HWND hWnd, // handle to window int nCmdShow // show state of window ); nCmdShow = SW_HIDE, hWnd = (CStatic*)GetDlgItem(this,IDC_test)->m_hWnd是这样子,没有错。你可以试一下,但代码我没有测试,也不是从我的程序中paste过来的。呵呵。
CStatic* hWnd = new CStatic; m_hWnd=(CStatic*)GetDlgItem(this,IDC_test); m_hWnd->ModifyStyle(0,SW_VISIBLE,0);
都不行啊,我把代码拷上去,编译说我错了:D:\all\JHG\JHGDlg.cpp(174) : error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'class CJHGDlg *const ' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast D:\all\JHG\JHGDlg.cpp(175) : error C2039: 'ModifyStyle' : is not a member of 'HWND__' c:\program files\microsoft visual studio\vc98\include\windef.h(195) : see declaration of 'HWND__' D:\all\JHG\JHGDlg.cpp(175) : error C2065: 'SW_VISIBLE' : undeclared identifier Error executing cl.exe.怎么回事呢,我太笨了,请大家教一下
BOOL ShowWindow(
HWND hWnd, // handle to window
int nCmdShow // show state of window
);
nCmdShow = SW_HIDE,
hWnd = (CStatic*)GetDlgItem(this,IDC_test)->m_hWnd是这样子,没有错。你可以试一下,但代码我没有测试,也不是从我的程序中paste过来的。呵呵。
m_hWnd=(CStatic*)GetDlgItem(this,IDC_test);
m_hWnd->ModifyStyle(0,SW_VISIBLE,0);
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\all\JHG\JHGDlg.cpp(175) : error C2039: 'ModifyStyle' : is not a member of 'HWND__'
c:\program files\microsoft visual studio\vc98\include\windef.h(195) : see declaration of 'HWND__'
D:\all\JHG\JHGDlg.cpp(175) : error C2065: 'SW_VISIBLE' : undeclared identifier
Error executing cl.exe.怎么回事呢,我太笨了,请大家教一下