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
Use one of the GraphicsPath::AddLine() overrides to add the points, do not call GraphicsPath::CloseFigure() as that will cause a line to drawn from the last point to the first point. Call Graphics::DrawPath() to draw the lines.
If you don't want to derive your own class and override functions, you can edit the string table in the resource editor. Locate the resource that is associated with your CDocTemplate (like IDR_MAINFRAME).
The string will look something like:
Test Application\n\nMFCTest\n\n\nMFCTest.Document\nMFCTest Document
Change it to:
Test Application\n\nMFCTest\nPliki bmp *.bmp)\n.bmp\nMFCTest.Document\nMFCTest Document<br />
If you need to do anything more complicated, like multiple extensions per doc template, check out this article:
The socket connects but never receives any data. The call to Receive seems to block the thread. I know the server program I am using is working because I can transfer data to other clients without a problem.