|
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!)
|
|
|
|
|
I don't know about recordsets but with normal files EOF only gets set after you go past the end of file. Meaning while(!eof) produces an extra read resulting in garbage
|
|
|
|
|
I am developing a project using ODBC RecordSet classes. I have a table with a date and time in it. The RecordSet class derived from CRecordSet contains COleDateTime object against the two i.e the date and the time.
Now I want to edit and clear these dates. How do I clear the dates from the Database.
This is urgent.. Anybody.. please
|
|
|
|
|
I have a small problem here, I need to somehow get the parameter from a template, eg <int> passed to a thread function...
I was thinking about something like:
template <typename T>
DWORD WINAPI WorkThread(LPVOID lpParameter);
but the compiler get's mad at me...
"error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'"
Is there any way to do this
I really need it, because I have a template class which get another class as it's parameter, then starts some threads, where the thread parameter is a pointer to the class passed as the template parameter.
In the thread I need to declare a pointer to that class, and then cast my thread parameter to that...
Does that make any sence???
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I don't think that you can take an address of a template function. Even reinterpret_cast or old-style cast will not help.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I was recently trying to do something similar and ended up using a virtual function with an abstract base. The worker thread is implemented as
UINT CMTDataAccess::RunQueryAllocateDataItems(LPVOID pParam)
{
CMTDataAccess* pThis = (CMTDataAccess*)pParam;
pThis->RunQueryAllocateDataItems();
pThis->m_bRunning = false;
return 0;
}
And each class that I implement, must inherit from the CMTDataAccess class. As well, each class must then implement a version of the RunQueryAllocateDataItmes() method.
Drop me an email, if you'd like any other gory details!
Chris
|
|
|
|
|
Hi all,
I want to know for using of Crystal Report 7.0, only i must add the ActiveX in my project ???
If possible write an example about opening the report file and indicate that by this ActiveX
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
why r u using the activex control?? you can use the class lib too if you want ... we do
can give you example code if you need this way
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi lauren,
How are you ?
---
I'm very very beginner in Crystal Report ...
So, please say to me:
Q1. Why i must use of LIB instead ActiveX ?
Q2. Which is faster ???
I'm wating for your helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi lauren,
So, i want to use of LIB for do it ...
In first please say to me, which libraries i must link to my project ???
And please write small example about opening the Report files by using of LIBs ...
Thanks alooot.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi all,
I'm developping an onscreen keyboard for a touchmatic system. I have buttons
for scrolling the page and I use IHTMLWindow2::ScrollBy methods. It works
for a single windowed documents (one body - one window) but I have problems
with scrolling of frames. I used 2 approach until now.
One is getting the parent window of active element of the current
document... I was hoping that it would be a frame... but it's always
"FRAMESET" and I know there are 3 frames because I saw them when I get the
list of the frames from IHTMLFramesCollection2...
For example... "www.osym.gov.tr" is a framed url. I must scroll down the
right side frame... (Yes I can scroll it by getting IHTMLWindow2 from
IHTMLFrameCollections2 but think there are 2 scroll-needed frames!...)
The other one is getting the parent window of the current document... this
gives me the "FRAMESET", too... the only exception is when no frame - one
body - one window...
I must find a way of getting the active frame... at least determine an
active frame myself and scroll it... (But the problem for this is the nested
frames... How deep I must go down!!!)... Can you give any advise?
Oguzhan...
|
|
|
|
|
Hello,
I tried to insert Microsoft FlexGrid Control in a console application that supports MFC but during the execution the flexible grid doesn't appeare. How can I solve this problem?
Thanks for any reply.
|
|
|
|
|
My first question is: a console app? How do you expect to see a grid if you don't have a window up? Providing you have a window, then we can talk.
|
|
|
|
|
Dear CodeGuy,
probably it's not clear that I have a console application SUPPORTING MFC, then it's obvious that I can show the windows. My problem is: I have inserted in a window the FlexGrid control and I call this window using the method "DoModal" but it doesn't appear
ASSO boys
|
|
|
|
|
What I mean is to start the application in a docking bar ,
then call different MDI interfaces of differnt functions
by clicking the BitmapButtons on the bar.How to realize
it by using MFC? I have developed a Dialog application by
using APPWIZEARD,then make it topmost ,NO TITLE &SYSMENU,
Drag&Move,but I can not realize the DOC/VIEW architectures
on the next step.How to?
thx everyone, and please forgiving my poor English.
.
|
|
|
|
|
Hi,
I've a question relating to IE.
I'm opening IE from VC, and passing a .htm file as command line arg. It opens fine.
But when I call it for the second time it opens in a new IE window, but I dont want this to happen. What should be done?
Yuvarajan JT
|
|
|
|
|
I have declared a function called Solve like this :
double Solve(double (pFn) (double), double pX);
Here the code for pFn :
double pFn(double pU)
{
return pow( pU*3.14-1.5, 3 );
}
I would like to know how to use the function Solve , which is needed to solve : pFn(X) = X ?
Thank in advance for your help.
Joe
|
|
|
|
|
Do your homework by yourself!!
|
|
|
|
|
VERY VERY FUNNY ANSWER !
I don't know how old are you, but I guess : 10-13.
Don't forget : "Boys will be Boys !", It is so true...
Joe
|
|
|
|
|
Hi,
Could anyone please show me an example how to create a hidden window? Thank you very much.
|
|
|
|
|
Just call ShowWindow with SW_HIDE.
|
|
|
|
|
Hi,
Does anyone have any tips or pointers for capturing an entire screen of other monitors other than primary monitor? Thank you very much.
|
|
|
|
|
Hi,
Could you please tell me how to use
HMENU GetMenu(
HWND hWnd // handle to window
);
function to get HMENU of Start Menu and Context Menu(right-click)? I use
GetMenu(GetForegroundWindow()) to get HMENU for standard application menu, but I don't know how to get HMENU for Start Menu and Context Menu(right-click). Could you please show me how. Thank you very much.
|
|
|
|
|
Hi,
I am trying to use
BOOL RegisterHotKey(
HWND hWnd,
// window to receive hot-key notification
int id,
// identifier of hot key
UINT fsModifiers,
// key-modifier flags
UINT vk
// virtual-key code
);
in my Win32 DLL. I have questions about what to pass to the first parameter. Can I create a hidden window in my DLL and pass its handle to the first parameter of RegisterHotKey function? And then I can process messages received by the hidden window? If this is a way to do it, could you please show me and give me some pointers how to do it, thank you very much. Or do you have any other easy ways to do this? Please let me know, thank you a lot.
|
|
|
|
|
If you pass NULL as first parameter, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop - no window procedure will receive them. If you create hidden window and pass its handle to RegisterHotKey, the window should receive the message. Of course, the calling thread needs a message queue.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|