|
For an SDI application, this is normal behavior. When a view asks the document for the data to be rendered, it has the choice of adding only new items, or adding all the items (again). I prefer the latter as it is much easier to clear the list control and add all of the items, contrasted with figuring out which items in the document are already in the view's list and which are not.
The MSDN article Q103982 might be remotely related to what you are seeing.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi David,
Thanks for the reply.
So how would I specify that I want the View to add only new items?
The article refers to VC++ 6.1 and older. I am using VC++ .NET. I did not find OnInitialUpdate() function in the .NET Framework for CView, which they talk about in the article.
TraileR ParK LifE 4Ever
|
|
|
|
|
/*Trucker*\ wrote:
So how would I specify that I want the View to add only new items?
How many total items are we talking about here?
/*Trucker*\ wrote:
The article refers to VC++ 6.1 and older. I am using VC++ .NET. I did not find OnInitialUpdate() function in the .NET Framework for CView, which they talk about in the article.
That's why I indicated it might only be remotely related.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am not sure why this is relevent but anyways... to give you an idea I will tell u what my application is.
It is Like Windows Explorer. So left pane is the directory tree, but the right pane holds just the files of selected folder in directory tree (dont worry about the third pane I mentioned earlier). So it could be a little, or it could be a lot of files/items... but lets say it shouldn't be too much because this is just an assignment for school I am doing, not some program for Bill Gates
TraileR ParK LifE 4Ever
|
|
|
|
|
I really don't know of a reason to not do it the way I previously suggested, especially for the volume of items you've indicated. It's just a much smoother approach to a fairly common doc/view situation.
I'm curious why you are creating the list views each time they need updating. That's seems a bit inefficient. Why not create them once at the start of the application, and then update their contents as the need arises? With MFC, this is very easy to do using CSplitterWnd .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How to use CRecordset with CByteArray for storing BLOBs
|
|
|
|
|
See the article:
Using CLongBinary for BLOBs - By Shekar Narayanan
http://codetools.com/database/usingblob.asp
This link may give you the answer. Try it.
http://msdn2.microsoft.com/library(d=printer)/07w94zsx(en-us,vs.80).aspx
http://www.codeguru.com/forum/showthread.php?t=120577
HAPPY VINAYAKA CHAVITI
Nice talking to you.
|
|
|
|
|
I made some small tests, it seems that delete[] can always replace delete, without errors.
But in my working project, it is not the case, I don't know why.
|
|
|
|
|
without errors, maybe ! but not without memory leaks !!!!!!!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 5:05 Tuesday 6th September, 2005
|
|
|
|
|
Some implementations might delete all memory, so you might not see any memory leak, but no implementation will call the destructor for every element in the array. If you have resources acquired by elements in the array, they won't get released until the program dies.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
This is what I call "Programming by Behavior" and it is EVIL EVIL EVIL. You are ignoring the rules and just going by how the program appears to work in specific instances.
The C++ standard specifically states that delete [] and delete are not interchangeable. Doing so might work sometimes, but that doesn't mean it will always work.
If you have a class with a destructor, using delete will only invoke the destructor on the first element. Thus causing all sorts of problems if the class has a non-trivial destructor.
NEVER EVER interchange delete with delete []. It is just wrong.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
"Appears to work" is not a synonym for "does work correctly."
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Works as coded.
Bob Ciora
|
|
|
|
|
p is a pointer to an array, when running, the 1 fragment is ok, the 2 one is wrong. What's the reason?
//in the destructor
//1
if (p!=NULL) {
for (int i=0;i
|
|
|
|
|
Here are a few new/delete pairs:
int *n = new int;
delete n;
int *n = new int[5];
delete [] n;
char (*p)[10] = new char[6][10];
delete [] p;
char **p = new char*[3];
p[0] = new char [6];
p[1] = new char [6];
p[2] = new char [5];
delete [] p[2];
delete [] p[1];
delete [] p[0];
delete [] p;
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
If p is pointing to a single variable then the normal delete is fine but in case of an array pointer it should be deleted using delete []p;
|
|
|
|
|
How to Store and retrieve Bitmap Image data from CByteArray.
|
|
|
|
|
Afther a long search over the internet and MSDN, I decided to ask someone more skilled than me that may be on this forum...
Is there possible to intercept an application file operation reqest? Let's say an application is triing to open a file, can I set a hook that notifies me that?
If not, how can this goal be accomplished? Writing kernel mode intermediate drivers for the i/o routines?
I hope I understand...because is a rough world out there...
|
|
|
|
|
|
Thanks for you answer, but I'm tring to find a way in order to intercept some file I/O actions...
Adica in timp dinamc sa imi spuna daca o aplicatie deschide o fila, citeste dintr-o fila, scrie intr-o fila, etc... Intrebarea era daca este posibli cu Hook-uri si cum, sau daca nu cum este posibil? - Mersi oricum
I hope you understand...because is a rough world out there...
|
|
|
|
|
Vlad Stanciu wrote:
Is there possible...
It's possible and, depending on your actual requirements, might not be a trivial task. You may need to create a virtual device driver, install a VxD service called IFSMGR_InstallFileSystemApiHook , or create a file system driver that "sees" all IRPs and FastIO requests directed at a drive.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello,
I am using MFC to call a stored procedure written in Oracle PL/SQL, but when I make
the call I get the next error in Spanish:
"No se enlazaron columnas antes de llamar a SQLFetchScroll o
SQLExtendedFetch", which more or less in English means:
"No rows were binded before calling SQLFetchScroll or SQLExtendedFetch".
I am using a CRecordset derived class to access the stored procedure. I am
unable to find the error.
THE STORED PROCEDURE'S HEADER:
Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario
VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle
VARCHAR2,
coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT
INTEGER)
THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed)
class CRecSP : public CRecordset
{
public:
CRecSP(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CRecSP)
CString m_szSQL;
long m_RETORNO;
virtual CString GetDefaultConnect();
virtual CString GetDefaultSQL();
virtual void DoFieldExchange(CFieldExchange* pFX);
};
THE .CPP FOR THE CLASS (VS6 comments removed)
IMPLEMENT_DYNAMIC(CRecSP, CRecordset)
CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb)
{
m_RETORNO = 0;
m_nParams = 1;
m_nDefaultType = snapshot;
}
CString CRecSP::GetDefaultConnect()
{
return _T( DB_CONNECTION_STRING );
}
CString CRecSP::GetDefaultSQL()
{
return m_szSQL;
}
void CRecSP::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputParam);
RFX_Long(pFX, _T("[retorno]"), m_RETORNO );
}
USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings
and formatted in the SQL)
CRecSP *rec = new CRecSP(&db);
szSQL.Format( "{CALL
FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}",
szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen,
szDetalle, "ERP", "0", szCodOT
);
rec->m_szSQL = szSQL;
//rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly );
rec->Open( );
iError = rec->m_RETORNO;
rec->Close();
-- modified at 3:49 Tuesday 6th September, 2005
|
|
|
|
|
Hello there.
I'm having difficulties on how I will add the data from one or several CStringArray to another CStringArray.
For e.g.
CStringArray strInfo[1] = { "12", "13", "14" };
CStringArray strInfo[2] = { "1", "2", "3", "4" };
CStringArray strInfo[3] = { "5", "6", "7", "8", "9", .... };
.
.
.
. and so on...
and the new CStringArray should have the data from strInfo[1], strInfo[2] and strInfo[3] ....
so it should be like this.
newStrInfo = { "12", "13", "14", "1", "2", "3", "4", "5", "6", "7", "8", "9", .... };
Please help me on this matter. Any help is much appreciated.
By the way, if it's possible to convert it in an integer array, please teach me too.
I also made the input data as integer array instead of CStringArray (int* strInfo[1], int* strInfo[2], int* strInfo[3]...) but still I can't pass the data into another data array.
Thanks and best regards.
With great power comes a great responsibility.
|
|
|
|
|
use this
details in MSDN, it`s a member of CStringArray
void InsertAt( int nStartIndex, CObArray* pNewArray );
CODE:
CStringArray strInfo1;
CStringArray strInfo2;
CStringArray newStr;
strInfo1.Add("TEST 1->1");
strInfo1.Add("TEST 1->2");
strInfo1.Add("TEST 1->3");
strInfo1.Add("TEST 1->4");
strInfo1.Add("TEST 1->5");
strInfo2.Add("TEST 2->1");
strInfo2.Add("TEST 2->2");
strInfo2.Add("TEST 2->3");
strInfo2.Add("TEST 2->4");
strInfo2.Add("TEST 2->5");
newStr.InsertAt( 0, &strInfo1);
newStr.InsertAt( strInfo1.GetSize(), &strInfo2);
for( int i=0; i
|
|
|
|
|
You can use CUIntArray instead of CStringArray, provided that you are using unsigned ints (==positive values).
Or, you can save your values as unsigned inte, and then (if you have to) cast them to signed ints.
Pseudo-code (should work, not tested):
for(i = 1; i < noOfArrays; i++)
{
for(j= 0; j < intInfo[i].GetSize(); j++)
newArray.Add(intInfo[i].GetAt(j));
}
|
|
|
|
|