Since i'm not defining this class inside the Header file i'm not able to access any controls and its values.
Previously i had as like below
//strSocketData is a control variable.
How can i access it in my "ReceiveMessage" method.
UINT RecieveMessage( LPVOID pParam )
//Disclaimer: It's not at all safe to pass around MFC objects. Instead you can pass around HWND's which is safe.
CYourDlg* pYourDlg = reinterpret_cast< CYourDlg* >( pParam );
pYourDlg->strSocketData.SetWindowText( pYourDlg->strResult );
SocketThread = AfxBeginThread(ReceiveMessage,this);
You mentioned that it is not safe is there anyother alternate.
No it's not at all thread safe to pass around MFC objects. Instead pass the HWND of your dialog. Then use SetDlgItemText to set the text for the item.
SetDlgItemText( hDialog, IDD_DIALOGCONTROL_ID, _T( "This is thread safe" ));
Well you cannot retrieve the strResult parameter too. To get around this store the buffer of strResult inside another pointer. Put both the handle to the dialog and the pointer to the buffer inside the struct and then pass this struct object to the thread.
Depends on what you mean by "loading". The OS loader is going to load a DLL so fast you don't need to show progress. Now if you initialization stuff in the DLL (like running database queries) that you want to show progress for you have to supply an interface for obtaining that progress information.
There is no magical way to show progress because, progress of "what". You have to account for the knowledge of the "what". That is your job as a programmer. It is sometimes referred to as "the domain". Check it out[^]
well my problem is
When i download a file (with a CFTPclient) i cant open it and the same moment.
I dont know how to create and use a thread (for the moment).
so i have to split the read /write in 2 functions and put the CFTPclient commands to download / upload in a OnTimer
Last Visit: 31-Dec-99 19:00 Last Update: 5-Dec-22 18:06