|
I was told that you can perform this conversion using the transforms and widen and narrow functions. But having played with the transform function, I keep getting an error regarding not beign able to find the widen() function. Where is widen() defined?
this is what i do:
wstring wstr;
string str;
transform(str, wstr, widen());
|
|
|
|
|
Where is widen() defined?
basic_ios
If you for some reason can't read the documentation, you might try the following:
Open an explorer window and navigate down to your MSVC include directory. Press F3. Type "widen(" (without the quotes) in the "Containing text" edit box.
Once you get a sample compiled you can get there even faster by pressing F12 from within the IDE.
|
|
|
|
|
I have an XML document that includes a DTD . I need to parse this file using VC++ using the DOM .Where can I find resources for doing this . Please help
Actx
|
|
|
|
|
http://www.codeproject.com/soap/#XML
I vote pro drink
|
|
|
|
|
I have a function which takes the IShellFolder object for a folder as a parameter, and loops through all the items in the folder. If it is a file, it adds it to a ListView control, and if it is a folder it calls itself. But the first time the function encounters a folder and calls itself, the pIShell->EnumObjects returns the error code -2147023673 which, according to the Error Lookup, is "The operation was canceled by the user.".
Can anyone figure out what's wrong? Here's the code:
void AddFilesFromFolder(IShellFolder *pIShell)
{
if (pIShell)
{
IShellFolder *pBrowse = NULL;
LPENUMIDLIST pFolder = NULL;
LPMALLOC pMalloc = NULL;
ITEMIDLIST *pNewId = NULL;
STRRET strDispName;
LVITEM lvItem;
DWORD pActual = 0;
DWORD dwAttrib;
IShellFolder *CurrentFolder;
HRESULT err;
err = SHGetDesktopFolder (&CurrentFolder);
if (err == NOERROR)
{
SHGetMalloc(&pMalloc);
err = pIShell->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (err == NOERROR)
{
lvItem.mask = LVIF_IMAGE | LVIF_TEXT;
while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
{
dwAttrib = SFGAO_FOLDER;
pIShell->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
if (!(dwAttrib & SFGAO_FOLDER))
{
pIShell->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
GetID3();
FillInfo();
ListAddItem();
}
if (dwAttrib & SFGAO_FOLDER)
{
CurrentFolder->BindToObject(pNewId, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
Add2(pBrowse);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
}
Thankyou.
-Rune Svendsen
|
|
|
|
|
Try setting hwndOwner and maybe it will show you a message.
MSDN says "If hwndOwner is set to NULL, the enumerator should not post any messages, and if user input is required, it should silently fail."
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Hi I've read the article in Code project about the mschart and how to set data. Now I would like to know how to set the labels.
Can anyone help?
Thanks
|
|
|
|
|
G'Day Anon
I may have the answer for you though I'm not 100% sure because I'm yet to get it working myself - but I have run out of time for the moment.
using the example on code project I have added the following code when the GO button is pressed. I have placed it just before the chart is refreshed.
The first bit sets the legend (only did 1 to see if it worked)
CVcPlot Plot = m_Chart.GetPlot();
CVcSeriesCollection SeriesCollection = Plot.GetSeriesCollection();
CVcSeries Series = SeriesCollection.GetItem(1);
Series.SetLegendText(_T("New Text"));
The next bit was to do the labels for each point on the axis. It is incomplete and not quite working but hopefully it will give you an idea and you can let me know how to fix it I am getting a bad function argument error when calling SetColumnLabel or SetRowLabel - something to do with my indexes I think.
CVcDataGrid DataGrid = m_Chart.GetDataGrid();
short i;
CString strLabel;
short nRows = DataGrid.GetRowLabelCount();
short nColumns = DataGrid.GetColumnLabelCount();
/* for (i=0; i
|
|
|
|
|
Hi Richard,
Sorry that I'm only answering now, it's just that I've been busy and only had the time to do this now.
I tried what you suggested and also get the same "bad function argument" error.
So I tried the following:
short index;
for ( i = 1; i < 11; i++ )
{
//strLabel.Format("row %d", i);
// strLabel = "Row Text";
index = i * 2;
// DataGrid.SetColumnLabel(index, 1, "");
strLabel = DataGrid.GetColumnLabel(index, 1);
}
And I get all the correct column names, i.e. R1, R2, R3, ... R10.
It almost seems to be the actual string variable that seems to give the problem???
Still trying. Have you had any success?
Rui
Rui
|
|
|
|
|
Hi Richard,
I tried the following:
DataGrid.SetColumnLabel(1, 1, "Column 1");
strLabel = DataGrid.GetColumnLabel(1, 1);
AfxMessageBox(strLabel);
This enables the C1 text in the datagrid to be changed. This seems to be the name of the first set of data.
But I'm still not able to change the Column labels.
Does anyone have a clue how to do it?
Regards
Rui
|
|
|
|
|
hi Richard,
The following works:
COleSafeArray saRet;
CString strLabel = "";
DWORD numElements[] = {10, 1}; // 10x10
//DWORD numElements[] = {10};
// Create the safe-array...
saRet.Create(VT_R8, 2, numElements);
// Initialize it with values...
long index[2];
for(index[0] = 0; index[0] < 10; index[0]++)
{
for(index[1] = 0; index[1] < 1; index[1]++)
{
double val = index[0]*10;
saRet.PutElement(index, &val);
}
}
// Return the safe-array encapsulated in a VARIANT...
m_Chart.SetChartData(saRet.Detach());
m_Chart.SetChartType(3);
CVcPlot Plot = m_Chart.GetPlot();
CVcSeriesCollection SeriesCollection = Plot.GetSeriesCollection();
CVcSeries Series = SeriesCollection.GetItem(1);
Series.SetLegendText(_T("New Text"));
CVcDataGrid DataGrid = m_Chart.GetDataGrid();
short i;
short nRows = DataGrid.GetRowLabelCount();
short nColumns = DataGrid.GetColumnLabelCount();
/* for (i=0; i {
strLabel.Format("col %d", i);
DataGrid.SetColumnLabel(i, 1, strLabel);
}
*/
short j;
// DataGrid.SetColumnLabelCount(10);
// count = DataGrid.GetColumnLabelCount();
for ( i = 1; i < 6; i++ )
{
//strLabel.Format("row %d", i);
strLabel = "Row Text";
j = i * 2;
// DataGrid.SetColumnLabel(j, 1, strLabel);
strLabel = DataGrid.GetColumnLabel(j, 1);
//AfxMessageBox(strLabel);
DataGrid.SetRowLabel(i, 1, "Row");
strLabel = DataGrid.GetRowLabel(i, 1);
}
m_Chart.SetShowLegend(TRUE);
m_Chart.Refresh();
Try it.
Thanks for your help
Rui
|
|
|
|
|
G'Day Rui,
I'd forgotten all about this! I'll dig out the code I was playing with at the time and try it out.
Thanks for your help!
Richard.
|
|
|
|
|
In Internet Explorer, when you choose "Organize Favorites" from the Favorites menu, you get a pop-up window with a list of the top level favorites items. You can click-and-drag items up and down in that list and double click on items to edit them. I need to do something similar in a dialog of my application. Is there some kind of scrollable, item-draggable ActiveX list control?
|
|
|
|
|
Plain CListCtrl isn't good? You absolutely need an ActiveX?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
If CListCtrl will do it, I don't need ActiveX. Does it support the click-and-drag functionality for changing the order of items in the list?
|
|
|
|
|
It notifies you when dragging is about to begin with LVN_BEGINDRAG. From this point you need to process WM_MOUSEMOVE and WM_LBUTTONUP to provide feedback and reordering. There's KB article Q214814 which describes similar steps for CTreeCtrl.
Probably CDragListBox would be easier to use, but it doesn't provide in-place renaming.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
CDragListBox was exactly what I was looking for! My list will be items which should only be editable from a modal child dialog so I won't want in-place renaming since each item in the list is really just a textual representation of more complex data.
Thank you for the help!
|
|
|
|
|
Could somebody tell me where can find the "wmstub.lib"??
|
|
|
|
|
|
Thank you very much!!
But my poor english make that i can't find it to download.
Could you give me the RUL of it?
|
|
|
|
|
|
I could be doing this completely wrong. I am trying to put a web browser inside an already created window. The m_htmlview member is actually a c++ wrapper for the IWebBrowser2 interface.
m_htmlview.Create( NULL,
dwStyle,
CRect( 0, 0, theRect.Width(), theRect.Height() ),
&theBrowser,
KnListID );
m_htmlview.Navigate("http://localhost:10000",NULL,NULL,NULL,NULL);
Problem is that when the Create method is called, it causes a memory exception. Is there anything I need to call before Create to properly initialize it? Or is it just not possible to use the IWebBrowser on anything but a dialog or SDI/MDI.
|
|
|
|
|
CoInitialize has been called?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Its an ATL project, so yes. And just in case it wasn't, I put a call to CoInitialize right before Create and it did nothing.
It dies in this code
BOOL CWnd::InitControlContainer()
{
TRY
{
if (m_pCtrlCont == NULL)
here --> m_pCtrlCont = afxOccManager->CreateContainer(this);
}
END_TRY
It would seem that afxOccManager would be NULL, but it is a macro for AfxGetModuleState()->m_pOccManager
hope that helps.
|
|
|
|
|
So you're mixing ATL with MFC... maybe calling AfxEnableControlContainer in InitInstance will help?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|