|
_anil_ wrote: you forgot static
If Function Declared In Class is going to used at Thread, then it declared Static otherwise not
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks
Regards
Anil
|
|
|
|
|
The definition function for the function SocketConnection should be at the top of the file if it's not declared before the AfxBeginThread statement.
UINT SocketConnection(LPVOID pParam)
{
return 0;
}
void CSomeClass::SomeMethod()
{
AfxBeginThread(SocketConnection,this);
}
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
You are right Nibu. This is allowed in C++, but not in C.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
NiceNaidu wrote: This is allowed in C++, but not in C.
It's allowed only if you have a declaration before the function is referenced.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Here is my small issue
SocketThread = AfxBeginThread(ReceiveMessage,this);
UINT static ReceiveMessage(LPVOID pParam)
{
return 0;
}
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.SetWindowText (strResult);
//strSocketData is a control variable.
How can i access it in my "ReceiveMessage" method.
|
|
|
|
|
sivaprakashshanmugam wrote: Since i'm not defining this class inside the Header file i'm not able to access any controls and its values.
sivaprakashshanmugam wrote: Previously i had as like below
strSocketData.SetWindowText (strResult);
//strSocketData is a control variable.
How can i access it in my "ReceiveMessage" method.
UINT RecieveMessage( LPVOID pParam )
{
CYourDlg* pYourDlg = reinterpret_cast< CYourDlg* >( pParam );
pYourDlg->strSocketData.SetWindowText( pYourDlg->strResult );
}
SocketThread = AfxBeginThread(ReceiveMessage,this); Hope this helps?
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Yes it sounds Good... i can able to read and write data.
Shall use this?. Is it it advisable?. Make sure i'm using it in MFC Activex control. You mentioned that it is not safe is there anyother alternate.
CYourDlg* pYourDlg = reinterpret_cast< CYourDlg* >( pParam ); pYourDlg->strSocketData.SetWindowText( pYourDlg->strResult );
|
|
|
|
|
sivaprakashshanmugam wrote: Yes it sounds Good...
Well did it work?
sivaprakashshanmugam wrote: 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.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
How do i know the progress of a DLL and display it? do i have to implement a progress bar? if so, how?
THks
|
|
|
|
|
KongHL wrote: How do i know the progress of a DLL and display it?
DLL's can evolve (progress) into EXE's over the course of a project or the lifetime of the product. Generally the rate of change would be too slow to display in a progress bar.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Is it possible to mark certain percentage of completion?
|
|
|
|
|
That's what a progress bar is for. I must not understand your question.
|
|
|
|
|
Can we have any access to DLL loading process and display/update it in progress bar?
|
|
|
|
|
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[^]
|
|
|
|
|
Can i ?
|
|
|
|
|
You have my permission, but not my blessing.
|
|
|
|
|
|
If you write the function, you can make it do whatever you want, within the limits of your skill as a programmer.
Is that really what you meant to ask ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
yes create+read+write
whitesky
|
|
|
|
|
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
|
|
|
|
|
I'm using GDI / CDC to draw a chart control and would like to draw the chart series antialiased. Currently the line chart is drawn using CDC::Polyline, which is fast but not 'pretty'.
In the GDI+ documentation I couldn't find a method to draw a polyline, only a polygon which is not exactly the same.
|
|
|
|
|
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.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
In MDI project: how can I add my file extensions filter string to dialog window CFileDialog ? It is displayed automaticly, when user press FILE/OPEN... menu. How and where can I modify this dialog?
For example: when I'm displaying CFileDialog I can add filter by myself, like this:
static char szFilter[] = "Pliki BMP (*.BMP)|*.BMP||";
CFileDialog FileDlg( TRUE, NULL, NULL,
OFN_HIDEREADONLY, szFilter );
~~~~
|
|
|
|