Take a look at GetProcessWorkingSetSize () and see if that's what you need. There's a whole slough of memory management functions in the API, just check out the documentation in MSDN! :) -ar
Alexander Ruscle
Posts
-
Virtual Memory Check -
Virtual Memory CheckTry
VOID GlobalMemoryStatus(
LPMEMORYSTATUS lpBuffer // pointer to the memory status structure
);hth -ar
-
Need a source safe expertSourceSafe provides a COM interface with which you can perform all the functions that you can from the command line, complete with the entire object model. There are several good help files in MSDN about it, particularly one entitled Microsoft Visual SourceSafe OLE Automation. Here's some sample code that will get a file out of SourceSafe if it's not checked out:
#include "ssapi.h" /*-------------------------------------------------------------------- void GetWritableFileFromSourceSafe (CString sSourceSafeFile, CString sOnDiskTargetFile) DESCRIPTION: Opens SourceSafe, using the default username with no password and attempts to get the specified file to a location on the local disk for modification. PARAMETERS: CString sSourceSafeFile The file in SourceSafe to retrieve. CString sOnDiskTargetFile The filename to write the SourceSafe file to. @x.-----------------------------------------------------------------*/ void CSourceSafeWrapper::GetWritableFileFromSourceSafe (CString sSourceSafeFile, CString sOnDiskTargetFile) { IVSSDatabase db; if (db.CreateDispatch ("SourceSafe")) { CString sSSDatabase, sUsername, sPassword; // This is a function that gets the name of the database (like // "\\SourceMachine\Sources\srcsafe.ini"), the username and // password to use. ReadSSLoginSettings (sSSDatabase, sUsername, sPassword); try { db.Open (sSSDatabase, sUsername, sPassword); // Note that if this fails, there is some memory inside the COM // object that leaks, but there's nothing I know to do about it. LPDISPATCH pDisp = db.GetVSSItem (sSourceSafeFile, FALSE); IVSSItem item (pDisp); // Make sure the item is not already checked out. if (item.GetIsCheckedOut ()) throw (new CMyAppException ("The file in SourceSafe you specified is already checked out by someone. Make sure it is not checked out before proceeding.")); CComBSTR bstrPath (sOnDiskTargetFile); item.Get (&bstrPath, VSSFLAG_USERRONO | VSSFLAG_REPREPLACE | VSSFLAG_FORCEDIRNO); } catch (COleDispatchException * pE) { // Pass this error on to the user. We transform the exception // into one of our so that we can report it and respond just // like one of our own errors. CString sMsg; pE->GetErrorMessage (sMsg.GetBuffer (MAX_
-
are those xml parsers worth beans?In my experience with using the MS XML parser, the results were fairly close to what you described (added to the code pile) plus giving my users the added benefit of extra time to go get that cup of coffee they need while my code plods through a 3MB XML file. Parsing the file manually speeds things up dramatically. To date I have not found an efficient parser, but that's mainly because all the good parsers have a lot of overhead while they make sure everything is kosher. In our situations we can probably make some assumptions about the particular file we're parsing, which can add to efficiency. -ar