|
expression ?
do you mean exception ?
if you're getting an unhandled exception, the easiest way to find out what it is is to.. handle it.
try
{
... do something
}
catch (CException *e)
{
e->ReportError();
}
|
|
|
|
|
I have just realised that the exception occurs in the block of code:
it comes up after running for sometime...
pRange = pSheet->GetRange( _bstr_t("A3"), _bstr_t("CQ9990") );<br />
<br />
for ( int iRow = 1;iRow <= N; iRow++)<br />
{<br />
for (int iColumn = 1; iColumn < N2; ++iColumn )<br />
{ <br />
_variant_t vItem = pRange->Item[(long) iRow ][ (long) iColumn];<br />
_bstr_t bstrText( vItem );<br />
raw_data[iRow][iColumn] = vItem;<br />
<br />
}<br />
}
|
|
|
|
|
Hi all,
i have two CUIntArray,i want to merge it and generate new CUIntArray,
but want no comman values are inserted in new array.
help me for this.
|
|
|
|
|
Le@rner wrote: but want no comman values are inserted in new array
And... what do you want ?
(could you write some formula, like: C[i] = A[i] | B[i] ?)
virtual void BeHappy() = 0;
|
|
|
|
|
i want if A[i]={a,c,e,d}
and B[i]={a,c,f,g}
than result is C[i]={a,c,d,e,f,g}
|
|
|
|
|
If the array are sorted (like the sample posted) then your task is almost trivial.
[added]
OK, I see array A is actually NOT ordered.
What is your requirement about?
[/added]
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]
modified on Friday, April 9, 2010 8:30 AM
|
|
|
|
|
A (maybe needed to be optimized) version :
void ProcessMerging(CUIntArray* pcaResult,
const CUIntArray& caFirst,
const CUIntArray& caSecond)
{
if (pcaResult) {
pcaResult->RemoveAll();
int iFirstSize(caFirst.GetSize()),
iSecondSize(caSecond.GetSize()),
iMaxSize(max(iFirstSize, iSecondSize));
for (int i = 0; i < iMaxSize; i++) {
bool bFirstPresented(i < iFirstSize),
bSecondPresented(i < iSecondSize);
if (bFirstPresented) {
pcaResult->Add(caFirst[i]);
if (bSecondPresented &&
caFirst[i] != caSecond[i]) {
pcaResult->Add(caSecond[i]);
}
} else {
pcaResult->Add(caSecond[i]);
}
}
}
}
virtual void BeHappy() = 0;
modified on Friday, April 9, 2010 7:27 AM
|
|
|
|
|
I guess it doesn't work even for sorted arrays (I suppose you should use two different indices).
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]
|
|
|
|
|
Right, now it is a "per-index merging" only...
virtual void BeHappy() = 0;
|
|
|
|
|
The following function works (at least I suppose it does...) with increasing-ordered arrays (without duplicate items):
void MergeArrays(CUIntArray & l, CUIntArray & r, CUIntArray & o)
{
int il = 0, ir = 0;
int lcount, rcount;
lcount = l.GetCount();
rcount = r.GetCount();
o.RemoveAll();
for (;;)
{
if ( il == lcount)
{
if ( ir == rcount) return;
o.Add(r[ir]);
ir++;
}
else
{
if ( ir == rcount)
{
o.Add(l[il]);
il++;
}
else
{
if (l[il] < r[ir])
{
o.Add(l[il]);
il++;
}
else if (l[il] > r[ir])
{
o.Add(r[ir]);
ir++;
}
else
{
o.Add(l[il]);
il++; ir++;
}
}
}
}
}
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]
modified on Friday, April 9, 2010 9:14 AM
|
|
|
|
|
Are the arrays increasing ordered ? :
l{0,0,3}
r{0,1,4}
virtual void BeHappy() = 0;
|
|
|
|
|
Yes, they have duplicates though.
If you see my latest precondition...
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]
|
|
|
|
|
It would exclude the duplicates :
void AddTail(CUintArray* pcArray, UINT uiNew)
{
if (pcArray) {
int iCount(pcArray->GetCount());
if (!iCount ||
pcArray[iCount -1] != uiNew) {
pcArray->Add(uiNew);
}
}
}
virtual void BeHappy() = 0;
|
|
|
|
|
I prefer the precondition, since it makes the merge function acting on homogeneus arguments.
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]
|
|
|
|
|
CUIntArray does not provide a 'Merge ' method hence you have to write your own.
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]
|
|
|
|
|
One possibility would be to merge them together, and then use std::unique() with erase() . Without actually trying it, however, I can't say for sure.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Good idea, unfortunately the OP chose an MFC class.
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]
|
|
|
|
|
Which is why I used the word possibility. It would require him to get the contents of the CUIntArray moved to an STL container first.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Yes, it is a nice idea. My 'unfortunately' was in fact a subtle suggestion (too subtle, I guess) to discard the MFC class.
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]
|
|
|
|
|
Another class from the same header :
void ProcessMerging(CMap<UINT,UINT,UINT,UINT>* pcResult,
const CUIntArray& caFirst,
const CUIntArray& caSecond)
{
if (pcResult) {
pcResult->RemoveAll();
int iFirstSize(caFirst.GetCount()),
iSecondSize(caSecond.GetCont()),
i(0);
for (i = 0; i < iFirstSize; i++) {
pcResult->SetAt(caFirst[i], 0);
}
for (i = 0; i < iSecondSize; i++) {
pcResult->SetAt(caSecond[i], 0);
}
}
}
virtual void BeHappy() = 0;
|
|
|
|
|
Hi,
I am tring place a progress bar on dialog and make it Marquee Progress Control in win32. I tried with some code in InitDialog ():
HWND hwndProgress=GetDlgItem(m_hwnd,IDC_PROGRESS1);
::SetWindowLongPtr(hwndProgress,GWL_STYLE,PBS_MARQUEE);
::SendMessage(hwndProgress,(UINT) PBM_SETMARQUEE,(WPARAM) TRUE,(LPARAM)50);
But Progress bar is not visible. If I comment SetWindowLongPtr(), progess bar visible but not marquee.
Plz guide.
|
|
|
|
|
Try it :
HWND hwndProgress = GetDlgItem(m_hwnd, IDC_PROGRESS1);
LONG_PTR lStyle = ::GetWindowLongPtr(hwndProgress, GWL_STYLE);
lStyle |= PBS_MARQUEE;
::SetWindowLongPtr(hwndProgress, GWL_STYLE, lStyle);
::SendMessage(hwndProgress, PBM_SETMARQUEE, WPARAM(TRUE), LPARAM(50));
virtual void BeHappy() = 0;
|
|
|
|
|
Thanks for reply but above code is working with MFC application but not win32 application.
In win32 Only blank Progress bar is coming.
I am using VS 2005.
Any help?
|
|
|
|
|
Try to change the control line in your .rc file:
CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_MARQUEE,7,7,156,14
...and then send only the PBM_SETMARQUEE message in your init scope
virtual void BeHappy() = 0;
|
|
|
|
|
If I change It display error:
error RC2104 : undefined keyword or key name: PBS_MARQUEE
I defined the PBS_MARQUEE in resource.h , error is not coming but progress bar is still empty and not in marquee mode.
modified on Friday, April 9, 2010 5:44 AM
|
|
|
|