| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1450 人关注过本帖
标题:请大家看看CWnd的问题
只看楼主 加入收藏
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
 问题点数:0 回复次数:2 
请大家看看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-02-07 18:53
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8078
专家分:6657
注 册:2005-11-7
收藏
得分:0 
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


本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2006-02-08 08:24
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
得分:0 

谢谢你:)

2006-02-08 17:31
快速回复:请大家看看CWnd的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020263 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved