| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 665 人关注过本帖
标题:请大家看看CWnd的问题
收藏  订阅  推荐  打印 
rxgmoral
Rank: 2
等级:注册会员
帖子:45
积分:550
注册:2006-1-18
请大家看看CWnd的问题

请大家看看CWnd的问题
想通过对话框的按键创建一个窗体
例如:
<<<<<<<<<Dialog.h>>>>>>>>
CWnd *m_sch;
<<<<<<<<<Dialog.Cpp>>>>>>>
RECT rect;
rect.top = 50;
rect.left = 50;
rect.right = 150;
rect.bottom = 100;
m_sch->Create(_T("CMyBtn"),NULL,WS_CHILD|WS_VISIBLE,rect,this,10000);
m_sch->ShowWindow(SW_SHOW);
m_sch->UpdateWindow();

编译成功,运行报错
这句话有错
m_sch->Create(_T("CMyBtn"),NULL,WS_CHILD|WS_VISIBLE,rect,this,10000);

请问错那了
谢谢:)

搜索更多相关主题的帖子: CWnd  sch  rect  Dialog  
2006-2-7 18:53
冰镇柠檬汁儿
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:51
帖子:5307
积分:53416
注册:2005-11-7

virtual BOOL Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
调用时机:
窗口建立时
作为主窗口,大多在InitInstance()中将直接或间接调用Create
作为子窗口,大多再父窗口建立后发出WM_CREATE消息,对其进行处理时OnCreate()中调用。
功能:
控制建立细节
CWnd实现:
.......
//注册窗口类,调用API建立窗口
// allow modification of several common create parameters CREATESTRUCT cs; cs.dwExStyle = dwExStyle; cs.lpszClass = lpszClassName; cs.lpszName = lpszWindowName; cs.style = dwStyle; cs.x = x; cs.y = y; cs.cx = nWidth; cs.cy = nHeight; cs.hwndParent = hWndParent; cs.hMenu = nIDorHMenu; cs.hInstance = AfxGetInstanceHandle(); cs.lpCreateParams = lpParam;
//在此调用虚拟函数PreCreateWindow,允许在实际建立之前“篡改”建立参数。
if (!PreCreateWindow(cs))
{
PostNcDestroy();
return FALSE;
}
AfxHookWindowCreate(this);
HWND hWnd = ::CreateWindowEx(cs.dwExStyle, cs.lpszClass, cs.lpszName, cs.style, cs.x, cs.y, cs.cx, cs.cy, cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams);
#ifdef _DEBUG
if (hWnd == NULL)
{
TRACE1("Warning: Window creation failed: GetLastError returns 0x%8.8X\n", GetLastError());
}
#endif
if (!AfxUnhookWindowCreate())
PostNcDestroy();
// cleanup if CreateWindowEx fails too soon
if (hWnd == NULL)
return FALSE;
ASSERT(hWnd == m_hWnd);
// should have been set in send msg hook
return TRUE;
}

这是我能找到的材料,希望对你有帮助,我没弄懂。
网址是:http://www.chinaaspx.com/archive/VC/1626.htm


冰镇柠檬汁儿
2006-2-8 08:24
rxgmoral
Rank: 2
等级:注册会员
帖子:45
积分:550
注册:2006-1-18

谢谢你:)

2006-2-8 17:31
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.062022 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved