Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
li heartice
|
Jun 24, 2010 - 3:38 AM
|
I used CGfxListCtrl like this CGfxColumnManager * pManager = m_wndList.CreateColumnManager();
pManager->DefineColumn(0, "", NULL, LVCFMT_LEFT, 0,fhNumeric);
pManager->DefineColumn(1, "No.", NULL, LVCFMT_LEFT, 80,fhNumeric);
pManager->DefineColumn(2, "Station", NULL, LVCFMT_LEFT, 150, fhEdit);
pManager->DefineColumn(3, "Address", NULL, LVCFMT_LEFT, 120,fhEdit);
pManager->DefineColumn(4, "Port", NULL, LVCFMT_LEFT, 150,fhEdit);
pManager->DefineColumn(5, "IP", NULL, LVCFMT_LEFT, 150, fhEdit);
pManager->DefineColumn(6, "Location", NULL, LVCFMT_LEFT, 150, fhComboBox);
pManager->DefineColumn(7, "Topology", NULL, LVCFMT_LEFT, 150, fhComboBox);
pManager->DefineColumn(8, "Type", NULL, LVCFMT_LEFT, 150, fhComboBox);
int _DEFCOLS[] = { 0,1,2,3,4,5,6,7,8};
pManager->DefineDefaultColumns(sizeof(_DEFCOLS)/sizeof(int), _DEFCOLS);
m_wndList.SetupColumnData();
CString sql,str;
m_adoMainTable.m_pDatabase=&m_db;
sql = "select * from MainTable";
TRY
{
m_adoMainTable.Open();//(CRecordset::dynaset ,sql);
if(m_adoMainTable.IsOpen())
{
m_adoMainTable.Requery();
if(!m_adoMainTable.IsEOF())//empty ?
{
m_adoMainTable.MoveFirst();
m_strCorpName=m_adoMainTable.m_CorpName;
m_nSaveCyc=m_adoMainTable.m_SaveTime;
}
}
m_wndList.OnInit();
m_wndList.ModifyFlag(0,fHighRowSelect|fVertGrid|fHorizGrid|fAutoSort,0);
CManagerApp *pApp=(CManagerApp *) AfxGetApp();
m_wndList.m_bEnableEdit=pApp->m_curUser.bConfig>0?1:0;
m_wndList.SetItemCount(MAX_STATIONNUM);
m_wndList.SetItemHeight(20);
int row=0;
m_adoStationTable.m_pDatabase=&m_db;
sql = "select * from StationTable";
m_adoStationTable.Open(CRecordset::dynaset ,sql);
if(m_adoStationTable.IsOpen())
{
m_adoStationTable.Requery();
int num= 0;
if(!m_adoStationTable.IsEOF())//empty ?
{
m_adoStationTable.MoveFirst();
num=m_adoStationTable.GetRecordCount();
}
m_wndList.SetRedraw(false);
m_wndList.BindRecordset(&m_adoStationTable);
m_wndList.SetExInfoCallback((long (CWnd::*)(LXHDREX *))&CDlgSysConfig::GetExInfoCallback);
m_wndList.FillRecordsetColumn();
m_adoRegionTable.m_pDatabase=&m_db;
sql = "select * from RegionTable";
m_adoRegionTable.Open(CRecordset::snapshot,sql);
if(m_adoRegionTable.IsOpen())
{
m_adoRegionTable.Requery();
VERIFY(m_wndList.LinkRecordset("Layout", &m_adoRegionTable , "RegionName", "RegionName",false));
}
m_adoTopologyTable.m_pDatabase=&m_db;
sql = "select * from TopologyTable";
m_adoTopologyTable.Open(CRecordset::snapshot,sql);
if(m_adoTopologyTable.IsOpen())
{
m_adoTopologyTable.Requery();
VERIFY(m_wndList.LinkRecordset("TopologyName", &m_adoTopologyTable , "TopologyName", "TopologyName",true));
}
m_wndList.FillRecordsetItems();
m_wndList.SetRedraw(true);
}
} But when I run it and double click on the cell that has fhComboBox type,the code stoped. BOOL CWnd::OnNotify(WPARAM, LPARAM lParam, LRESULT* pResult)
{
ASSERT(pResult != NULL);
NMHDR* pNMHDR = (NMHDR*)lParam;
HWND hWndCtrl = pNMHDR->hwndFrom; // get the child ID from the window itself
UINT nID = _AfxGetDlgCtrlID(hWndCtrl);
int nCode = pNMHDR->code; ASSERT(hWndCtrl != NULL);
ASSERT(::IsWindow(hWndCtrl)); //it stoped here if (_afxThreadState->m_hLockoutNotifyWindow == m_hWnd)
return TRUE; // locked out - ignore control notification // reflect notification to child window control
if (ReflectLastMsg(hWndCtrl, pResult))
return TRUE; // eaten by child AFX_NOTIFY notify;
notify.pResult = pResult;
notify.pNMHDR = pNMHDR;
return OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), ¬ify, NULL);
}
So I trace it form OnLButtonDblClk. void CGfxInCombo::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CWnd::OnLButtonDblClk(nFlags, point);
// ClientToScreen(&point);
NMHDR nh; //this is a local var
nh.hwndFrom = GetParent()->GetSafeHwnd();
nh.idFrom = GetParent()->GetDlgCtrlID();
nh.code = NM_DBLCLK;
GetParent()->GetParent()->PostMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM) &nh);
}
I go on trace and find the Address of "nh" was be changed at CExtNcFrameImpl::NcFrameImpl_PreWindowProc. bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{ //Stop here,the method init vars
m_bNcFrameImpl_RestoreBorder = false;
Then, How can I face to it?
|
|
li heartice
|
Jun 28, 2010 - 2:39 AM
|
E~,It’s that,My Dialog "class CDlgSysConfig :" is inherit from "public CExtNCW < CExtResizableDialog > ". CGfxInCombo is a child of CGfxCtrlList,and the CGfxCtrlList is a List Control of CDlgSysConfig which is inherit from "public CExtNCW < CExtResizableDialog > ". when I Double click the CGfxInCombo,I Send a WM_NOTIFY to CDlgSysConfig(the parent’s parent of the CGfxInCombo). then I was tracing the code,I find that: In the class of "CExtNCW < CExtResizableDialog >",the virtual method "virtual WindowProc( UINT message, WPARAM wParam, LPARAM lParam )" take me to run "bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )" first,in that method,when it init its local parameters,the last Parameter(the local var nh) of the WM_NOTIFY message has been coverd,
(I Tracing the address of CGfxInCombo’s local var "nh" and find it changed at
bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{ //Stop here,the method init vars
m_bNcFrameImpl_RestoreBorder = false;
)
when it run to my OnNotify Method "BOOL CDlgSysConfig::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) " ,the parameters has been changed yet and assert false.
|
|
Technical Support
|
Jun 28, 2010 - 10:30 AM
|
This is a really interesting task. The CExtNcFrameImpl::NcFrameImpl_PreWindowProc() method does not handle the WM_NOTIFY message and it cannot change your message’s parameters. Could you create some test project demonstrating this problem and send it to the support mail box at this web site?
|
|
li heartice
|
Jun 28, 2010 - 9:55 PM
|
I try to create a sample about this problem. First I create a simple dialog with vs6.0,and chage the parent of mydialog form CDialog to CExtNCW < CExtResizableDialog >,then I run it. A message dialog show that: "User breakpoint called from code at 0x********" I find the debug window show message too: "Second Chance Assertion Failed: File E:\bakef\vs6pro\Test624\Prof-UIS\Src\ExtPaintManager.cpp, Line 264" What happend? And how do I deal with it?
|
|
li heartice
|
Jun 29, 2010 - 2:32 AM
|
As a see the FAQ,I add the wizard on my vs6.0 and create a sample(a very simple test project). When I double click the item in my list control,it assert again. I have send the test project to support email, the subject is "the WM_NOTIFY message doesn’t work correctly". Please check the email and I expect for your help.
|
|
Technical Support
|
Jun 30, 2010 - 8:31 AM
|
The problem is in the CMyListCtrl::OnLButtonDblClk() method:
GetParent()->PostMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM) &nh);
That code posts a WM_NOTIFY message and passes a pointer to a local stack variable ( nh ). This is an error. You should use the following instead: GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM) &nh);
|
|
li heartice
|
Jun 30, 2010 - 7:28 PM
|
CGfxListCtrl and CGfxInCombo are parts of a Third-party control named gfxlist.I used it in my project,and it post but not send the WM_NOTIFY message to mydialog,then it bring me into this problem,I search for the author of the gfxlist first but no result,so I turn to our site for help. I can only change the source code of the gfxlist to solve it. Now,I know it’s not caused by our product but the gfxlist control,thanks.Best regards.
|
|
li heartice
|
Jun 28, 2010 - 2:39 AM
|
E~,It’s that,My Dialog "class CDlgSysConfig :" is inherit from "public CExtNCW < CExtResizableDialog > ". CGfxInCombo is a child of CGfxCtrlList,and the CGfxCtrlList is a List Control of CDlgSysConfig which is inherit from "public CExtNCW < CExtResizableDialog > ". when I Double click the CGfxInCombo,I Send a WM_NOTIFY to CDlgSysConfig(the parent’s parent of the CGfxInCombo). then I was tracing the code,I find that: In the class of "CExtNCW < CExtResizableDialog >",the virtual method "virtual WindowProc( UINT message, WPARAM wParam, LPARAM lParam )" take me to run "bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )" first,in that method,when it init its local parameters,the last Parameter(the local var nh) of the WM_NOTIFY message has been coverd,
(I Tracing the address of CGfxInCombo’s local var "nh" and find it changed at
bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{ //Stop here,the method init vars
m_bNcFrameImpl_RestoreBorder = false;
)
when it run to my OnNotify Method "BOOL CDlgSysConfig::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) " ,the parameters has been changed yet and assert false.
|
|
Technical Support
|
Jun 29, 2010 - 9:58 AM
|
We received your e-mail. Please check if you may have forgotten to add the res subfolder of your test project into the ZIP file.
|
|
li heartice
|
Jun 29, 2010 - 6:41 PM
|
I have repack it and send it with the subject "the WM_NOTIFY message doesn’t work correctly 2" yet,please check it,thanks.
|
|
li heartice
|
Jun 28, 2010 - 2:39 AM
|
E~,It’s that,My Dialog "class CDlgSysConfig :" is inherit from "public CExtNCW < CExtResizableDialog > ". CGfxInCombo is a child of CGfxCtrlList,and the CGfxCtrlList is a List Control of CDlgSysConfig which is inherit from "public CExtNCW < CExtResizableDialog > ". when I Double click the CGfxInCombo,I Send a WM_NOTIFY to CDlgSysConfig(the parent’s parent of the CGfxInCombo). then I was tracing the code,I find that: In the class of "CExtNCW < CExtResizableDialog >",the virtual method "virtual WindowProc( UINT message, WPARAM wParam, LPARAM lParam )" take me to run "bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )" first,in that method,when it init its local parameters,the last Parameter(the local var nh) of the WM_NOTIFY message has been coverd,
(I Tracing the address of CGfxInCombo’s local var "nh" and find it changed at
bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{ //Stop here,the method init vars
m_bNcFrameImpl_RestoreBorder = false;
)
when it run to my OnNotify Method "BOOL CDlgSysConfig::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) " ,the parameters has been changed yet and assert false.
|
|
li heartice
|
Jun 28, 2010 - 2:38 AM
|
E~,It’s that,My Dialog "class CDlgSysConfig :" is inherit from "public CExtNCW < CExtResizableDialog > ". CGfxInCombo is a child of CGfxCtrlList,and the CGfxCtrlList is a List Control of CDlgSysConfig which is inherit from "public CExtNCW < CExtResizableDialog > ". when I Double click the CGfxInCombo,I Send a WM_NOTIFY to CDlgSysConfig(the parent’s parent of the CGfxInCombo). then I was tracing the code,I find that: In the class of "CExtNCW < CExtResizableDialog >",the virtual method "virtual WindowProc( UINT message, WPARAM wParam, LPARAM lParam )" take me to run "bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )" first,in that method,when it init its local parameters,the last Parameter(the local var nh) of the WM_NOTIFY message has been coverd,
(I Tracing the address of CGfxInCombo’s local var "nh" and find it changed at
bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{ //Stop here,the method init vars
m_bNcFrameImpl_RestoreBorder = false;
)
when it run to my OnNotify Method "BOOL CDlgSysConfig::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) " ,the parameters has been changed yet and assert false.
|
|
li heartice
|
Jun 27, 2010 - 11:58 PM
|
|
|
Technical Support
|
Jun 25, 2010 - 3:21 AM
|
The CGfxListCtrl control is not part of Prof-UIS. We can help you only if you create some test project with this control for us.
|
|