|
Its probably all CStrings. THe array was supposedly of a fixed size. What if it were a vector? Would i still pass in the pointer?
I think I have a handle on how to insert the items row by row, so I'll hold off on posting about that. Hopefully I wont need to..
Appreciate your help,
ns
|
|
|
|
|
if it's a vector, you should pass a reference (not a pointer) to the vector. then you'll iterate through the vector, either with an iterator or with myVec[x] or myVec.at(x).
-c
All you have to do is tell the people they are being attacked, and denounce the opposition for lack of patriotism and exposing the country to danger.
-- Herman Goering, on how to control the public
|
|
|
|
|
[ Modified article: Corrected call to InsertItem() ]
void addItems
(CStringArray arrayOfStrings)
{
for (long nIndex=0; (nIndex < arrayOfStrings.GetLength()); nIndex++) {
list2.InsertItem (nIndex, arrayOfStrings.GetAt (nIndex);
}
}
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have added a CEdit control and CSpin control to my dialog in the resource editor. So I attached the CSpin control to my CEdit control to inc and dec the value in the edit!
But now, I have the problem, that the spin is working the wrong way! When I click the up button of the spin, the value in the edit will dec, and when I click the down button the value will inc! That's not what I am want! How can I change this????
--
Nice greets, Daniel.
|
|
|
|
|
The "wrong way" is the default way for spin controls.
you will have to use a SetRange32( int nLower, int nUpper );
Set nLower to the MAXIMUN
set nUpper to the MINIMUM
|
|
|
|
|
Thanks!
--
Nice greets, Daniel.
|
|
|
|
|
Hi Daniel,
use CSpinButtonCtrl::SetRange(MIN_VALUE, MAX_VALUE) - this adjusts in which direction you have to press the arrows in order to de- or increase the value in the buddy CEdit box.
Gero
|
|
|
|
|
Hi Daniel,
You can either give the ranges other way round or you can override CWnd's OnNotify method
BOOL YourClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) <br />
{<br />
LPNMHDR pnmh = (LPNMHDR) lParam; <br />
<br />
if(pnmh->code == UDN_DELTAPOS )<br />
{<br />
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pnmh;<br />
if(pNMUpDown->iDelta < 0)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
}<br />
return true;<br />
}
-ve value of delta would suggest decrement and +ve would suggest increment
you can reverse the ways if you like.
Hope that would be of your help.
Nilesh
|
|
|
|
|
Thanks!
--
Nice greets, Daniel.
|
|
|
|
|
I'm writing a program which uses a derived classe of CSocket to handle incoming data. I have overloaded OnReceive to catch the new data. My question is this.
In my OnReceive function, I read the data and possibly do something with it. The doing something can take a little time. I'm wondering if OnReceive can be called while I'm still processing a previous OnReceive and thus interrupting my processing.
If it can, what kind of protections can I setup to protect the data I access in the function?
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
u are just one thread right?? Or multithreading?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Currently the application is single threaded. My question was, si there a possibility that MFC events or whatever they are called, can they overlap. Or will only one be called at any given time
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
nope the cant, cos ur single threaded.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
How in the world can i get this to work
if i use IXMLDOMNode in the idl it compiles
if i use the using namespace in the c++ code i'm still good
however the headers created from the idl result in the following:
error C2872: 'IXMLDOMNode' : ambiguous symbol
Help!
|
|
|
|
|
In your idl file,
#include "msxml2.idl";
This will help MIDL solving type, while not including this idl in the type-library.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Tried that and all i get from midl is
error MIDL2025 : syntax error : expecting an interface name or DispatchInterfaceName or CoclassName or ModuleName or LibraryName or a type specification near
idl = [id(1), helpstring("method TestXml")] HRESULT TestXml(IXMLDOMNode *pIXMLDOMNode);
atl class method = STDMETHOD(TestXml)(IXMLDOMNode *pIXMLDOMNode);
|
|
|
|
|
Ok, I have found the issue. The version of msxml.idl shipping with VC++6 and VS.NET is MSXML2. And the idl provided does not include the declaration of IXMLDOMNode.
You need MSXML3, and higher. Download the SDK here[^].
I just did a test, it went fine with import "msxml2.idl"; . I had also to make sure this file msxml2.idl supersedes msxml.idl from the included header directories.
PS : I would suggest you don't marshall IXMLDOMNode* at all, just a void* instead. And then you do a proper QI or cast in the implementation code.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Hello:
I'm having problems trying to add a serie to a chart. This piece of code illustrates my problem:
_ChartPtr pChart= pCharts->Item["G1"]; // Get an existing chart (OK)
_WorksheetPtr pWorksheet= pWorksheets->Item["S1"]; // Get an existing worksheet (OK)
SeriesCollectionPtr pSeries= pChart->SeriesCollection(); // Get its series collection (OK)
RangePtr pRangeSector1= pWorksheet->Range["$C$5:$C$8"]; // Get a worksheet range (OK)
// I am only trying one of these lines
// Line 1
SeriesPtr pSerie1= pSeries->Add((IDispatch *)pRangeSector1, Excel::xlColumns); // Try to add a serie (exception launched)
// Line 2
SeriesPtr pSerie2= pSeries->Add("C5:C8", Excel::xlColumns); // Try to add a serie (exception launched)
Where is the mistake?
Thanks in advance.
|
|
|
|
|
I have a class say, CClass thats inherts from two abstract interface definition classes, say IInterface1 and IInterface2. I have a vector of IInterface1 pointers and a vector of IInterface2 pointers. If the pointer of CClass is added to both these vectors, is there a smart pointer inplemenataion that would delete CClass, only when pointers in both vectors are deleted?
I am not very familiar with smart pointers, but was curious to know whether smart pointers would work in this case. I am looking for a generic C++ solution, not a COM or MFC based solution.
I looked at shared_ptr in boost.org, but could not make a judgement about this from the docs and examples.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I have a map of int, int.
Someone told me that this statement below will create the element of index n1 and fill it with n2:
n2 = myMap[n1];
instead of the othe way around which works as well. THe benefit of the above method is that if that element already exists in the map, then in one shot we either accessed it (pree-exist) or created it (wasnt there). Seems so counterintuitive. Is it ccorrect? Didnt see anything like it in my books...
Appreciate your help,
ns
|
|
|
|
|
myMap[n1] = n2; SHOULD work, ie create an entry if it does not already exit
n2 = myMap[n1]; SHOULD NOT work, it should create an entry if it does not exist and give n2 its value.
|
|
|
|
|
Okay.But if myMap[n1] just got created its empty right? So n2 = 0.
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Someone told me that this statement below will create the element of index n1 and fill it with n2
it's not true, and you can prove it with the code below.
map<int, int> myMap;
int t = 50;
t = myMap[10];
map<int, int>::iterator it;
for (it=myMap.begin(); it!=myMap.end(); it++)
{
printf("%d, %d\n", (*it).first, (*it).second);
}
the output is 10, 0; not 10, 50.
it will create the element, but the value part of it is the default value for the object (for an int, i guess the default is 0, in debug mode anyway).
if you want to set the value, you have to use : myMap[10] = 50;
-c
All you have to do is tell the people they are being attacked, and denounce the opposition for lack of patriotism and exposing the country to danger.
-- Herman Goering, on how to control the public
|
|
|
|
|
Many thanks. Clear now.,
Appreciate your help,
ns
|
|
|
|
|
Hi all.
I have a application writen in VC++. I need to execute a script file on a server in it. Did any one know how to do it?
Thanks for any clue.
Tida
|
|
|
|