|
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?
|
|
|
|
|
That worked. Thanks a ton!
|
|
|
|
|
I just recently noticed this remark in the MSDN Library:
[For] Windows 2000/XP: If CREATE_ALWAYS is specified as the value of the dwCreationDisposition parameter and FILE_ATTRIBUTE_NORMAL is specified as the value of the dwFlagsAndAttributes parameter, CreateFile will fail and set the error GetLastError reports to ACCESS_DENIED . In this case, set the value of the dwFlagsAndAttributes parameter to the ORed value of the FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_NORMAL attributes to avoid this error.
Now, IIUC, code that once used CREATE_ALWAYS with FLAG_ATTRIBUTE_NORMAL and worked correctly on Win9x and WinNT will now start to FAIL when run on Win2K/XP? That makes no sense to me, because it could break existing applications and code. This also means that I can only create new files if they are initially hidden from now on?
Also, that remark also conflicts with what is mentioned earlier in the page for CreateFile , because it says for FLAG_ATTRIBUTE_NORMAL : "The file has no other attributes set. This attribute is valid only if used alone."
Thoughts? (Note that I am not having any problems relating to this so far, nor have heard any reports.)
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
|
|
|
|
|
Tested this on XP, and file is always created - even if file with identical name already exists. Seems like problem with documentation.
HANDLE h = ::CreateFile("c:\\x.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD dummy;
CString strx;
strx.Format("%d", GetTickCount());
::WriteFile(h, strx, strx.GetLength(), &dummy, NULL);
::CloseHandle(h);
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Tested this on XP, and file is always created
Yeah, I know it still works correctly; as I said, I am not having an problem. I am just wondering if anyone is actually experiencing the documented issue.
FWIW, this has been in the documentation at least since the October '01 edition...
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
|
|
|
|
|
I need a function that takes a Day-of-Year as an integer and converts it back to a day and a month, and returns the month and day as two integers.
|
|
|
|
|
could you be a little more detailed in your question, i dont follow what you mean by 'day-of-year'.. an example could help too..
do you mean the 153rd day of the year, finding what the actual date is like 05/13?
-dz
|
|
|
|
|
What I mean by day-of-year is this:
if I pass 3,15,2002 into a function i would take 3 and 15 and convert that into the number of the year that 3/15 translates to.
More importantly. I need to take a interger and pass it into a function ( say 74) and get what day and month that corresponds to. I am not using MFC, and need to do this w/o any special functions.
|
|
|
|
|
Have you checked COleDateTime or CTime ?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
is right here. The representation that you are talking about is called the Julian day. The formulas listed on that page will convert Julian days to Gregorian calendar days and vice-versa.
--Dean
|
|
|
|
|
I would like to access a 2D array using pointers. I understand that
I could use function such as pointers to array of pointers to
achieve that. How do I actually do that? and how do I
allocate memory to it using new and delete function?
-Danny
|
|
|
|