Click here to Skip to main content
16,010,394 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ANY GURU TO EXPLAIN THIS? Pin
Carlos Antollini3-Jul-01 5:08
Carlos Antollini3-Jul-01 5:08 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Stan Shannon3-Jul-01 7:07
Stan Shannon3-Jul-01 7:07 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
CodeGuy3-Jul-01 7:27
CodeGuy3-Jul-01 7:27 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Daniel Visan3-Jul-01 20:51
Daniel Visan3-Jul-01 20:51 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Daniel Visan3-Jul-01 21:58
Daniel Visan3-Jul-01 21:58 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Mike Burston4-Jul-01 20:00
Mike Burston4-Jul-01 20:00 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Daniel Visan4-Jul-01 21:25
Daniel Visan4-Jul-01 21:25 
GeneralRe: ANY GURU TO EXPLAIN THIS? Pin
Mike Burston5-Jul-01 12:42
Mike Burston5-Jul-01 12:42 
Daniel,

I cannot try an exact test of your problem because you have not posted the entire code, only the portions relating to the 'populateList' function, which is where you are getting a crash/error in the SetItemData (after a few iterations). The point I am making is that you probably have an error somewhere else - nothing in the 'populateList' code appears likely to generate the errors you are reporting. The exception you are trapping is telling you clearly that you are attempting an operation on a closed ADO object. "SetListItem" is not related to ADO in any way. A quick search of the MFC source shows that SetItemData is like many MFC functions - a very thin wrapper around the corresponding win32 API calls. In this case, it's essentially just a call to "SendMessage(m_hwnd, LVM_SETITEM, 0, (LPARAM)pItem)".

_AFXCMN_INLINE BOOL CListCtrl::SetItem(const LVITEM* pItem)
{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); }
_AFXCMN_INLINE BOOL CListCtrl::SetItemData(int nItem, DWORD dwData)
{ ASSERT(::IsWindow(m_hWnd)); return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); }

The point is, and remains, that it is likely you have a subtle problem somewhere in the ADO record set handling code. This problem is subtle enough that it only causes an exception in some circumstances - in other cases (something as apparently simple as removing a call to "SetItemData") the error still occurs, but has not visible effect. In other words, your program may 'appear' to run fine now that you have removed the "SetItemData" call, but it is probable that you have simply curied a symptom, not the disease. Again, I think you need to leave "SetItemData" alone, and concentrate on the rest of the code. Somewhere in there you have a logic error waiting to bite you at some point in the future (probably when you can least afford the time to find it!)


AnswerRe: ANY GURU TO EXPLAIN THIS? Pin
4-Jul-01 18:27
suss4-Jul-01 18:27 
GeneralCOleDateTime Pin
3-Jul-01 4:41
suss3-Jul-01 4:41 
GeneralThreadProc and templates Pin
Anders Molin3-Jul-01 2:55
professionalAnders Molin3-Jul-01 2:55 
GeneralRe: ThreadProc and templates Pin
Tomasz Sowinski3-Jul-01 6:04
Tomasz Sowinski3-Jul-01 6:04 
GeneralRe: ThreadProc and templates Pin
Chris Meech3-Jul-01 7:13
Chris Meech3-Jul-01 7:13 
GeneralCrystal Report question ... Pin
Hadi Rezaee3-Jul-01 1:50
Hadi Rezaee3-Jul-01 1:50 
GeneralRe: Crystal Report question ... Pin
l a u r e n3-Jul-01 5:25
l a u r e n3-Jul-01 5:25 
GeneralRe: Crystal Report question ... Pin
Hadi Rezaee3-Jul-01 7:45
Hadi Rezaee3-Jul-01 7:45 
GeneralRe: Crystal Report question ... Pin
Hadi Rezaee3-Jul-01 20:20
Hadi Rezaee3-Jul-01 20:20 
GeneralActive Frame IE Pin
Oguzhan ERKAN3-Jul-01 0:55
Oguzhan ERKAN3-Jul-01 0:55 
GeneralMicrosoft FlexGrid Control Pin
2-Jul-01 23:52
suss2-Jul-01 23:52 
GeneralRe: Microsoft FlexGrid Control Pin
CodeGuy3-Jul-01 7:30
CodeGuy3-Jul-01 7:30 
GeneralRe: Microsoft FlexGrid Control Pin
3-Jul-01 22:08
suss3-Jul-01 22:08 
Questionhow to realize a dialog bar application ,which calls several MDI interfaces Pin
2-Jul-01 23:27
suss2-Jul-01 23:27 
GeneralIE Launch from VC Pin
Yuvarajan JT2-Jul-01 23:19
Yuvarajan JT2-Jul-01 23:19 
GeneralPointer to a function Pin
2-Jul-01 22:37
suss2-Jul-01 22:37 
GeneralRe: Pointer to a function Pin
3-Jul-01 4:57
suss3-Jul-01 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.