|
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 );
~~~~
|
|
|
|
|
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:
http://www.codeproject.com/docview/DocViewEnhancements.asp[^]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
So I only have to make my own class (document template) derived from CMultiDocTemplate, use it like here:
pDocTemplate = new CMyMultiDocTemplate(<br />
IDR_CONTEXTTYPE,<br />
RUNTIME_CLASS(CMyDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView));<br />
AddDocTemplate(pDocTemplate);
and then override function DoPromptFileName() in this class? Or is there anything more to do?
And how can I use my own filter string in DoPromptFileName()? I don't know how to do this.
Thanks for any help.
~~~~
|
|
|
|
|
I'm trying to figure out why my CSocket.Receive() call is blocking. This is the code I have so far:
CSocket socket;<br />
<br />
socket.Create();<br />
ret = socket.Connect(m_sAddress, m_nPort);<br />
<br />
if (ret == 0)<br />
{<br />
<br />
GetSocketError();
return -1;<br />
<br />
}
<br />
m_TotalBytes = 0;<br />
<br />
<br />
while(m_bRunThread)<br />
{<br />
<br />
BYTE* pBuffer = new BYTE[MAX_BUFFER_SIZE];<br />
ret = socket.Receive(pBuffer, MAX_BUFFER_SIZE);<br />
<br />
<br />
........<br />
}<br />
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.
Any suggestions? Thanks
|
|
|
|
|
Use CAsyncSocket instead of CSocket. CSocket assumes synchonous communications (that is, you will send, then wait for a return message).
An alternative is to put the socket's receive call in a worker thread that fires off an event when it receives data in the buffer.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I have my own list derived from CListCtrl, i implement DrawItem myself. the list has a style LVS_EX_CHECKBOXES. so in the DrawItem i see if the item is checked i draw a check box in checked style and if it is not checked i draw a check box unchecked.
the list also has a style : single selection, show always, and full row selection.
problem is what i start the application and i try to check the first item. it checks it ok.
then i want to uncheck but nothing happens. in the draw item i still see the status of checked.
also in the OnItemChanging implementation, i see the newstate still checked....the only way to unchecked the item is to try and check an other item...then it uncheck the first item and checked the selected new item. i am not familiar with this behavior, i know that when u check an item, it stays checked until you uncheck it, and not when u check an other item. also if you check an other item , the first item you've checked should stay checked.
can any1 help?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Try RedrawWindow() on Item changed event.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
it doesn't work....the item state after it is checked remains checked....
what else is wrong?
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|