为什么会提示“参数不足,期待是1”?
我在框架类的OnCreateClient中增加了一个视图的初始化,运行程序时就出现了“参数不足,期待是1”的警告,不知如何处理,望各位大虾帮帮忙,谢谢!
BOOL CRightPaneFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_pSubmitView = new CSubmitView;
m_pSubmitView->Create(NULL, NULL, 0L,
CFrameWnd::rectDefault, this, VIEW_SUBMIT, pContext);
SetActiveView(m_pSubmitView);
m_pSubmitView->ShowWindow(SW_SHOW);
m_pSubmitView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_nCurrentViewID = VIEW_SUBMIT;
m_pListCtrlView = new CListCtrlView;
((CView*) m_pListCtrlView)->Create(NULL, NULL, 0L,
CFrameWnd::rectDefault, this, VIEW_LISTCTRL, pContext);
m_pListCtrlView->ShowWindow(SW_HIDE);
m_pListCtrlView->SetDlgCtrlID(VIEW_LISTCTRL);
m_pModifyView = new CModifyView;
((CView*) m_pModifyView)->Create(NULL, NULL, 0L,
CFrameWnd::rectDefault, this, VIEW_MODIFY, pContext);
m_pModifyView->ShowWindow(SW_HIDE);
m_pModifyView->SetDlgCtrlID(VIEW_MODIFY);
RecalcLayout();
return TRUE;
}
加入m_pModifyView 后就出错了,唉!
问题点数:20、回复次数:19Top
1 楼laughsun(啸傲)回复于 2001-05-22 09:50:00 得分 0
本程序上面是否还有其他代码??
Top
2 楼ldkk(老道)回复于 2001-05-22 09:54:00 得分 0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter window\n");
return FALSE;
}
// Get the client rect first for calc left pane size
CRect rect;
GetClientRect(&rect);
// create the left tree view first.
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CLeftPaneView),
CSize(rect.Width() / 4 - 25, 0), pContext))
{
TRACE0("Failed to create left pane view\n");
return FALSE;
}
// The right pane is a frame which and contain several different views.
// The is can be set to active or non-active
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CRightPaneFrame), CSize(0, 0), pContext))
{
TRACE0("Failed to create right pane frame\n");
return FALSE;
}
CLeftPaneView* pLeftPaneView = (CLeftPaneView*)
m_wndSplitter.GetPane(0, 0);
pLeftPaneView->m_pRightPaneFrame = (CRightPaneFrame*)
m_wndSplitter.GetPane(0,1);
// Set the left pane as the active view
SetActiveView((CView*) m_wndSplitter.GetPane(0, 0));
return TRUE;
}
这是主框架的OnCreateClient代码,不知有没有参考价值?
Top
3 楼sunlightbj(阳光)回复于 2001-05-22 09:59:00 得分 0
你亲自来问了?呵呵
会不会是你在用odbc,调mdb的时候出错Top
4 楼laughsun(啸傲)回复于 2001-05-22 09:59:00 得分 0
m_wndSplitter.CreateStatic(this, 1, 2)
是创建一行两列的窗口,就是只有两个客户区,所以会出错(因为你创建了三个),你可以改成
m_wndSplitter.CreateStatic(this, 3, 1)
应该可以了。
Top
5 楼ldkk(老道)回复于 2001-05-22 10:06:00 得分 0
不行呀,我创建的是一行两列的窗口,右窗口实现三个视图切换的功能。之前两个视图切换时不会报错,但加了第三个(m_pModifyView )就出错了。Top
6 楼laughsun(啸傲)回复于 2001-05-22 10:08:00 得分 0
错误地方指在哪里??Top
7 楼ldkk(老道)回复于 2001-05-22 10:15:00 得分 0
void PASCAL CWnd::SendMessageToDescendants(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL bDeep, BOOL bOnlyPerm)
{
// walk through HWNDs to avoid creating temporary CWnd objects
// unless we need to call this function recursively
for (HWND hWndChild = ::GetTopWindow(hWnd); hWndChild != NULL;
hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT))
{
// if bOnlyPerm is TRUE, don't send to non-permanent windows
if (bOnlyPerm)
{
CWnd* pWnd = CWnd::FromHandlePermanent(hWndChild);
if (pWnd != NULL)
{
// call window proc directly since it is a C++ window
AfxCallWndProc(pWnd, pWnd->m_hWnd, message, wParam, lParam);
}
}
else
{
// send message with Windows SendMessage API
::SendMessage(hWndChild, message, wParam, lParam);
}
if (bDeep && ::GetTopWindow(hWndChild) != NULL)
{
// send to child windows after parent
SendMessageToDescendants(hWndChild, message, wParam, lParam,
bDeep, bOnlyPerm);
}
}
}
我跟踪到AfxCallWndProc(pWnd, pWnd->m_hWnd, message, wParam, lParam);一句报错。
Top
8 楼ldkk(老道)回复于 2001-05-22 10:16:00 得分 0
void PASCAL CWnd::SendMessageToDescendants(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL bDeep, BOOL bOnlyPerm)
{
// walk through HWNDs to avoid creating temporary CWnd objects
// unless we need to call this function recursively
for (HWND hWndChild = ::GetTopWindow(hWnd); hWndChild != NULL;
hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT))
{
// if bOnlyPerm is TRUE, don't send to non-permanent windows
if (bOnlyPerm)
{
CWnd* pWnd = CWnd::FromHandlePermanent(hWndChild);
if (pWnd != NULL)
{
// call window proc directly since it is a C++ window
AfxCallWndProc(pWnd, pWnd->m_hWnd, message, wParam, lParam);
}
}
else
{
// send message with Windows SendMessage API
::SendMessage(hWndChild, message, wParam, lParam);
}
if (bDeep && ::GetTopWindow(hWndChild) != NULL)
{
// send to child windows after parent
SendMessageToDescendants(hWndChild, message, wParam, lParam,
bDeep, bOnlyPerm);
}
}
}
我跟踪到AfxCallWndProc(pWnd, pWnd->m_hWnd, message, wParam, lParam);一句报错。
Top
9 楼laughsun(啸傲)回复于 2001-05-22 10:19:00 得分 0
能否把错误的英文打出来,全部的错误。。。Top
10 楼ldkk(老道)回复于 2001-05-22 10:29:00 得分 0
就是我运行程序时,会弹出一个对话框,上面的信息只有“参数不足,期待是1”(中文),然后进到程序的界面,没有别的报错信息了。Top
11 楼laughsun(啸傲)回复于 2001-05-22 10:34:00 得分 0
昏到!
能否把原程序寄给我,我调试一下。。
e_mail: li_bing@cvicse.com.cnTop
12 楼ldkk(老道)回复于 2001-05-22 10:38:00 得分 0
好,辛苦了!Top
13 楼laughsun(啸傲)回复于 2001-05-22 10:44:00 得分 0
不好意思,让你久等了。Top
14 楼ldkk(老道)回复于 2001-05-22 10:49:00 得分 0
呵呵,我寄过去了Top
15 楼lhh2394(lhh2394)回复于 2001-05-22 21:59:00 得分 0
我原来在WIN98下编的ODBC访问程序,在WIN98下运行很正常,但到WIN2000下运行出现与你一样的提示。Top
16 楼laughsun(啸傲)回复于 2001-05-22 22:37:00 得分 10
我在win98下编译也出现这种错误,应该是数据库方面的问题,不是分屏的问题。Top
17 楼ldkk(老道)回复于 2001-05-23 08:33:00 得分 0
有没有解决的办法呢?Top
18 楼smith02(独上兰舟)回复于 2001-05-23 08:55:00 得分 10
我也见到过这个问题,最后发现是数据库方面的问题,记录集的成员变量与数据库的字段对应错误!!!!!!!Top
19 楼ldkk(老道)回复于 2001-05-23 12:49:00 得分 0
问题已经解决了,正是记录集的成员变量与数据库的字段对应错误造成的,谢谢大家的帮助!!!Top




