|
With your code the output should be Name,Class\nABC,123,1\n. What output do you want with the same input?
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
As far as I understood, he wants the string "ABC,123" be considered as one column in the CSV file. But this has nothing to do with C++, rather with the CSV syntax in which he has put double quotes around the field.
|
|
|
|
|
I am not very good at guess games
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Well, spending a lot of time in the programming forums improves that a lot...
|
|
|
|
|
This has nothing to do with C++ but rather to the CSV format. If you google for the format specification (see here[^] for instance) you can see that:
Fields with embedded commas must be enclosed within double-quote characters.
|
|
|
|
|
|
How is the correct way to subclassing my CHeaderCtrl class into my CListCtrl ?
Let say I have CListCtrlEx , ( public of CListCtrl ) , and I have a CHeaderCtrlEx class ( public of CHeaderCtrl ) and I need to subclassing into CListCtrlEx ... how it's correct way to do it ?
I tell you for what I need subclassing : I want to improve my CListCtrlEx class to CHeaderCtrlEx class from here[^] and saw there , that CHeaderCtrlEx is subclassing into CListCtrlEx ...
|
|
|
|
|
For a dialog it could be performed as following :
BOOL CYourDialog::OnInitDialog()
{
BOOL bResult = CDialog::OnInitDialog();
CHeaderCtrl* pcOriginalHeader(m_cListCtrl.GetHeaderCtrl());
if (pcOriginalHeader->GetSafeHwnd()) {
m_cHeader.SubclassWindow(pcOriginalHeader->GetSafeHwnd());
}
return bResult;
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
And what if I create the list control dinamicaly ( with Create ) ?
int CTestList3View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(CListView::OnCreate(lpCreateStruct) == -1)return -1;
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | LVS_REPORT;
BOOL bResult = m_List1.Create(dwStyle,CRect(0,0,0,0),this,IDC_LIST1);
return (bResult ? 0 : -1);
}
|
|
|
|
|
Then - place the subclassing lines previos to the 'return' line...
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
It goes with PreSubclassWindow() right after Create() !
Thanks for solution ! Thanks all of you !
|
|
|
|
|
|
I use App Wizard to create a new MFC ActiveX Control. On the "Control Settings" page, I select SysListView32 for "Create control based on:". But now, I don't know how to add new column and item to the list view. I try to get the handle by using GetSafeHwnd() and then send LVM_INSERTCOLUMN message but nothing happens.
modified on Thursday, December 16, 2010 4:09 AM
|
|
|
|
|
Assuming the handle is correct, this approach seems okay. Maybe the LVCOLUMN wasn't filled correctly?
Try something like this:
LVCOLUMN col;
col.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_FMT;
col.pszText = "Name";
col.cx = 200;
col.fmt = LVCFMT_LEFT;
SendMessage(hwndList,LVM_INSERTCOLUMN,0,(int)&col);
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Thanks, I tried your code but nothing displayed. Can anybody show me step by step to add new columns and items? I use VS2005!
|
|
|
|
|
--------------------------------------------------------------------------------
Hi ALL
I created a new dialog resouce. Now I want to remove it from the project. How to do this.
Thanks
|
|
|
|
|
Just select that dialog (IID_DIALOG1)in Resource view and press the delete button. Thats it....
|
|
|
|
|
Hi,
I have to Store CMap Object with "Key Name" as CString and "Key Value"
as CArray Object.is it possible?
|
|
|
|
|
|
Hi all,
I have made a application in which i have a list control. Suppose that list control has 5 items when i press a button a thread is started using AfxBeginThread. Inside that thread i have made a for loop. That for loop pick up items from list and do some processings say a,b,c. These processing use functions of some other classes to get their result. I have a made a second button, by clicking on that second button i stop my thread using ::TerminateThread(obj,NULL);. My problem is when i click on second button my thread doesn't stop say if it is doing processing b first it will finish doing b then c then it will stop. I tried using ::TerminateThread(obj->m_hThread, NULL); but it also creates problem after some time i.e if i start and stop my processing for 3 times it will not start the process third time.
I don't know what to do?
Can anybody help me in this?
Thanks in advance
|
|
|
|
|
1. Show us the relevant code.
2. Never use TerminateThread() .
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
As Rajesh said, never never use the TerminateThread function, unless you perfectly know what you are doing. Here[^] is an excellent article about threads, a bit long but it is definitively something to read if you want to start using threads.
Taken from the article:
Three functions immediately present themselves for purposes of pausing or shutting down a thread: the SuspendThread and ResumeThread methods (and their underlying API calls, ::SuspendThread and ::ResumeThread) and ::TerminateThread. Assume, for all practical purposes, except in some very limited contexts, these functions do not exist. Using them will almost always get you in trouble.
|
|
|
|
|
The better way would be to set a stop-variable and check its value regularly during the thread execution. When it's set to 1, the thread is in control of what to do to terminate.
This way, the thread has a chance to clean up memory and terminate properly.
As for the direct problem of why TerminateThread won't work, does your handle have the access rights to terminate it?
modified 13-Sep-18 21:01pm.
|
|
|
|
|
donot call the method TerminateThread
use the global memeber variable . BOOL isRunning
check the variable isRunning in the loop. if FALSE exit the thread.
|
|
|
|
|
Hi, ALL
I am using VC++ 6.0. I created a single document MFC application. I did not add any new codes to the project. After compiling, the program works fine.
To learn the execution procedure, i set some break points within
BOOL CxxxApp::InitInstance(), CxxxDoc::OnNewDocument() and CxxxView::OnInitialUpdate().
I run the application in debug mode.
I observe that the program first goes into InitInstance(). After exeuting if(!
ProcessShellCommand(cmdInfo)) within InitInstance(), the program goes into CxxxDoc,then into
CxxxView. After that, the program goes back into InitInstance() again to execute the remaining two statements
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
I tried but failed to find the intrinsic reason. What makes the program to run in this manner.
I found nowhere CxxxDoc::OnNewDocument() and CxxxView::OnInitialUpdate() are called explicitly
BOOL CxxxApp::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
SetRegistryKey(_T("Local...));
LoadStdProfileSettings();
CSingleDocTemplate * pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CxxxDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CxxxView));
AddDocTemplate(pDocTemplate);
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if(!ProcessShellCommand(cmdInfo))<----
return FALSE;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
}
Would you please recommand some reference books or articles on this to me.
modified on Tuesday, December 14, 2010 8:20 AM
|
|
|
|