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.
I am developing a dialog application. In my dialog i have a tabcontrol which is having two tab pages. I have shortcut like Alt+x for my dialog. If the focus is in propertypage these shortcuts are not working. What should i do to enable those?
GetMessage and PeekMessage are used to get a message from message queue while PostMessage is used to post a message.
The major difference between GetMessage and PeekMessage is that GetMessage doesn't return until it finds a message to retrieve from the
Message Queue and PeekMessage() returns immediately weather there are any messages or not.
While PostMessage is used to post a message to window and it returns immediately without waiting for the response.
I am trying to launch a dialog in modal-less mode but am getting error:
Bool CDialog::Create cannot convert from int to LPCTSTR but the tutorials says to do it this way. Any help appreciated. Here my prog:
THIS IS A MFC DLL
// Ai.cpp : Defines the initialization routines for the DLL.
// Microsoft Visual C++ generated include file.
// Used by Ai.rc
#define IDP_SOCKETS_INIT_FAILED 101
#define IDD_CONFIGURE_DIALOG 1000
#define IDC_TXMESSAGE 1000
#define IDD_TRACEINFO 1001
// Next default values for new objects
#define _APS_NEXT_RESOURCE_VALUE 1002
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 1000