I have made a dialog based application in that i have made a List control and a button....
On that button click event a timer has been called every 10000 ms and inside that timer i have called a worker thread which is calculating some values and then i want to diaplay those values in that list control, for that i have made a object of a class and then i am inserting the values... but as soon as control reaches there program crashes and give a debug assertion failed error...
Your all GUI related stuff should be in the UI thread (supposedely the main thread of the application).
When the worker thread is done with its calculations, it should PostMessage to the parent window of the list ctrl (or some other relevant window in the UI thread) by sending the result of its calculation. The important point here is that the worker thread MUST NOT directly modify a UI element, e.g. a list control (this would cause sync issues with unexpected errors).
All synchronization objects works the same way regarding this, e.g. locking a mutex, releasing a semaphore or setting an event.
In your case the event will be set until some thread calls any of the wait functions such as ::WaitForSingleObject(). The event may be set up to automatically reset when the thread that waits on the event gets released, or it may be set to be "manual reset" in which case you have to call ::ResetEvent() to set the event in a non-signalled state.
But, you have to call any of the waiting functions in order to find out whether the event is signalled or not.
You may call ::WaitForSingelObject() with a timeout value of zero in which case the function will return with WAIT_TIMEOUT unless the event was set.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
I want to do FTP client application in vc 6.0/MFC which should include the following functions,
1.Connect to the ftp server..(here i use local host)
1.List the directories in tree view and Navigation between directories.
2.Enumerating, creating, removing, and renaming directories.
3.Renaming, uploading, downloading, and deleting files.
i don know how to start from the scratch. I use the local host and user as anonymous. can anyone guide me how to connect to the ftp local host/server. I hav confusion between winsocket and wininet.. which one i should use for ftp client application and tell me how to proceed further?
Actually i am getting several url 's from the server and i want to the url in my window application(Using MFC) in a CListCtrl.
But it is giving runtime error in InsertItem() ans SetItemText() function although complied with 0 erroes.
Can anyone tell me what is the problem.
My code is as follows:
void CMainDlg::UpdateFootPrintsForVisitor(int n, CString strResponseFootPrints)
From where you are calling method UpdateFootPrintsForVisitor from your code?
Is the m_lstGetFootPrints object is valid at that time?
Just try ::IsWindow(m_lstGetFootPrints.m_hWnd) to make sure that the control is created and ready to work.
Last Visit: 31-Dec-99 18:00 Last Update: 27-Sep-21 2:50