|
I'm sorry, i mis-wrote it as 'c++', its actually 'c'.Thnx for pointing out the mistake. 
|
|
|
|
|
For instance:
char myCharArray[]={ 'a', 'b', 'c', 'd', 'e'};
char c = myCharArray[3];
BTW Good C tutorial needed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
rdop wrote: I am new student to MCA.
Unless you have 0 experience with the C language, a person pursuing a Master's degree, especially in a computer-related field, should easily be able to find this with minimal effort.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I have made a dialog based application in that i have made a List control and a button....
On that button click event a timer has been called every 10000 ms and inside that timer i have called a worker thread which is calculating some values and then i want to diaplay those values in that list control, for that i have made a object of a class and then i am inserting the values... but as soon as control reaches there program crashes and give a debug assertion failed error...
i just wanted to known how to remove this??/
Thanks in advance
|
|
|
|
|
VCProgrammer wrote: but as soon as control reaches there program crashes and give a debug assertion failed error...
We can't start guessing unless you show us the code with causes the crash!
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
CTestDlg *obj = new CTestDlg;
int r = obj->m_List.GetItemCount();
obj->m_List.InsertItem(r,Header);
|
|
|
|
|
VCProgrammer wrote: CTestDlg *obj = new CTestDlg;
Have you created this dialog by calling it's Create function or DoModal?
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
|
You're trying to update the control from the worker thread, right?
If you are, post a user message to the main thread and update the list control from there.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
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).
Have a look at this article:
http://www.codeproject.com/KB/cpp/SyncMultithreadedMFC.aspx[^]
--
Arman
|
|
|
|
|
Hi Everyone,
I have some confusion with WaitForSingleObject.
Is it necessary for a thread to be in wait state to handle an event?
for example,
Thread1 {
SetEvent(event);
}
Thread2{
while(true) {
if(WaitForSingleObject(event, INFINITE)){
SetEvent(event); //event raised again, but handler thread 2 is not in wait now
}
}
}
Thanks
laksh
|
|
|
|
|
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
|
|
|
|
|
Hi,
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?
|
|
|
|
|
see the link
http://www.codeproject.com/KB/IP/ftpserver.aspx
|
|
|
|
|
Thanks for the reply..The Link which you hav sent deal with FTP Server.. I need FTP Client Application...
|
|
|
|
|
Ok, then this link will help
http://msdn.microsoft.com/en-us/library/hf9x9wb4.aspx
if you still any problem to develop, we can find any already developed source and understand it ?
|
|
|
|
|
|
Hi,
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)
{
if(n>-1)
{
if(strResponseFootPrints.IsEmpty())
return;
CStringArray* ptrstrArray = CParser::Parse(strResponseFootPrints,g_strDelimFLD);
for(int i=0; i<ptrstrarray->GetSize(); i++)
{
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = i;
lvItem.iSubItem = 0;
lvItem.pszText = _T("Sandra C. Anschwitz");
int nItem=m_lstGetFootPrints.InsertItem(&lvItem);//error line during run
m_lstGetFootPrints.SetItemText(nItem,0,(LPCTSTR)(ptrstrArray->GetAt(i)));
}
}
Thanks in Advance
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: lvItem.pszText = _T("Sandra C. Anschwitz");
This could be issue (just guessing), try this...
TCHAR szName[] = _T("Sandra C. Anschwitz");
lvItem.pszText = szName;
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Just fill the ivItem with 0 to ensure that all other fields are not holding any garbage values.
for(int i=0; iGetSize(); i++)<br />
{<br />
LVITEM lvItem;<br />
ZeroMemory(&lvItem, sizeof(LVITEM));<br />
lvItem.mask = LVIF_TEXT;<br />
lvItem.iItem = i;<br />
lvItem.iSubItem = 0;<br />
lvItem.pszText = _T("Sandra C. Anschwitz");<br />
<br />
int nItem=m_lstGetFootPrints.InsertItem(&lvItem);
m_lstGetFootPrints.SetItemText(nItem,0,(LPCTSTR)(ptrstrArray->GetAt(i)));<br />
}
cheers
Varghese Paul
|
|
|
|
|
Hi,
Still its giving error in the InsertItem() and SetItemText() function.
Please Tell me what to do.
Thanks
Dhiraj Kumar Saini
|
|
|
|
|
Dhiraj kumar Saini wrote: Still its giving error in the InsertItem() and SetItemText() function.
Please Tell me what to do.
MSDN on iSubItem...
iSubItem
One-based index of the subitem to which this structure refers, or zero if this structure refers to an item rather than a subitem.
You are giving zero based, that should be the problem if it's a report style list.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi,
Actually i want ClistControl with only one column to show one data data. It does not contain anyother sub item. So iSubItem is given value zero and not one.
Dont know what to do.
Thanks
Dhiraj Kumar Saini
|
|
|
|
|
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.
cheers
Varghese Paul
|
|
|
|
|
U r gr8
It worked ::IsWindow(m_lstGetFootPrints.m_hWnd)
Thanks a lot.
u r genius
Dhiraj
|
|
|
|