|
Gunnar Mätzler wrote:
...it and it takes less then a second to search for an specific entry).
However, if i put this on cd-rom its about 2800% !!! slower.
So every second of HDD time equates to 29 seconds of CD time? It's true that CD-ROM drives will be slower than HD drives, but how much slower depends on a lot of factors. I suggest reading this guide to see what all is going on.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Every time you ask for data on a CD that is not right after the last data you asked for the CD will need 1 second to position. So you need to figure out how you can read your table in order.
Suggestion: Get Knuth's "The art of computer programing" out, and look for the sections on searching from tape.
|
|
|
|
|
Thank you
My Project Files:
MainFrm.cpp (MainFrm.h)
Outlook.cpp (Outlook.h)
OutlookDoc.cpp (OutlookDoc.h)
OutlookListView.cpp (OutlookListView.h)
OutlookTreeView.cpp (OutlookTreeView.h)
OutlookView.cpp (OutlookView.hh)
==================== From MainFrm.cpp (Fragment of Code) ====================
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
UNREFERENCED_PARAMETER(lpcs);
if (!m_wndSplitter1.CreateStatic(this, 1, 2))
return FALSE;
if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(COutlookView), CSize(0, 0), pContext))
return FALSE;
if (!m_wndSplitter2.CreateStatic(&m_wndSplitter1, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0, 1)))
return FALSE;
if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(COutlookTreeView), CSize(0, 0), pContext))
return FALSE;
if (!m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(COutlookListView), CSize(0, 0), pContext))
return FALSE;
m_wndSplitter1.SetColumnInfo(0, 150, 0);
m_wndSplitter2.SetColumnInfo(0, 150, 0);
return TRUE;
}
==================== From OutlookTreeView.cpp (Fragment of Code) ====================
void COutlookTreeView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
const COLORREF rgb = RGB(255, 0, 255);
TV_INSERTSTRUCT tvstruct;
TCHAR rgszItems[][20] = { _T("Mail Box"), _T("Calendar"), _T("Deleted Items"), _T("Inbox"), _T("Journal"), _T("Notes"), _T("Outbox"), _T("Sent Items") };
VERIFY(m_ilTree.Create(IDB_BITMAP3, 16, 8, rgb));
GetTreeCtrl().SetImageList(&m_ilTree, TVSIL_NORMAL);
HTREEITEM hParent = NULL;
for (int nIndex = 0; nIndex < (sizeof(rgszItems) / sizeof(rgszItems[0])); nIndex++)
{
tvstruct.hParent = nIndex == 0 ? NULL : hParent;
tvstruct.hInsertAfter = TVI_LAST;
tvstruct.item.iImage = nIndex;
tvstruct.item.iSelectedImage = nIndex;
tvstruct.item.pszText = rgszItems[nIndex];
tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
HTREEITEM hItem = GetTreeCtrl().InsertItem(&tvstruct);
hParent = hParent == NULL ? hItem : hParent;
}
GetTreeCtrl().Expand(GetTreeCtrl().GetRootItem(), TVE_EXPAND);
}
==================== From OutlookDoc.cpp (Fragment of Code) ====================
BEGIN_MESSAGE_MAP(COutlookDoc, CDocument)
//{{AFX_MSG_MAP(COutlookDoc)
ON_COMMAND(ID_TOGGLE_TREE, OnToggleTree)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void COutlookDoc::OnToggleTree()
{
AfxMessageBox(_T("OnToggleTree"));
//???????????????????? CODE FOR ToggleTree ??????????????
}
|
|
|
|
|
Using GetFileTime(),can get the last-modified time of a file.i need actually the elapsed time.how can i get?
|
|
|
|
|
Monisankar wrote:
i need actually the elapsed time
Elapsed time? I can only assume you mean last_modified_time - create_time. Is that correct?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Actyally i need the intervals that have elapsed since 1601 and want to get this value as unsigned long.What should i do?
|
|
|
|
|
FILETIME ftCreate,
ftLocal;
GetFileTime(hFile, &ftCreate, ...);
FileTimeToLocalFileTime(&ftCreate, &ftLocal);
FILETIME ftSystem;
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &ftSystem); Now you can compare ftLocal with ftSystem .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yesterday I learnt how to fetch text manipulate it and write it back to the screen with the code below
void CReverseView::OnReverse()
{
// TODO: Add your command handler code here
CEdit &edit = GetEditCtrl();
CString strText;
edit.GetWindowText(strText);
_strrev(strText); // do something
edit.SetWindowText(strText);
GetDocument()->SetModifiedFlag(TRUE) ;
}
edit.SetWindowText(strText); replaces all the previous text. with the result of "do something"
Lets say the result of "do something" is xyz.
How do I add "Result is " before showing xyz?
I tried edit.SetWindowText("result is"); but this gets overwritten
Thanks
|
|
|
|
|
Since strText is a CString object, you can simply use the += operator.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thank you!
|
|
|
|
|
Hello!
I am a absolute beginner!
I found a source here about HOOK - realized with DLL. I use the DLL in my app to wait for key_down. But I have problem. I want my app to come to the top, when the CALLBACK-procedure has identified a key press. How can I do it easily?
Thank you very much for code samples!
|
|
|
|
|
I have about 40 controls on a dialog that use OnCtlColor to paint themselves the same background color as the bitmapped background they sit on top of. You can page through multiple pages of data very fast, and the program kept crashing. I noticed while watching task manager, that it was eating incredible amounts of memory on paging, and removed the OnCtlColor stuff, and it stopped eating memory and crashing. Here's what the code looks like:
<br />
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
switch (pWnd->GetDlgCtrlID()) <br />
{<br />
case IDC_FIELD01:<br />
pDC->SetBkColor(RED);<br />
pDC->SetTextColor(WHITE);<br />
hbr = CreateSolidBrush(RED);<br />
break;<br />
...etc...<br />
return hbr;<br />
}<br />
<br />
What is the best way to handle that problem, and anybody know why it would eat so much memory?
Thanx,
Rick
|
|
|
|
|
Do the CreateSolidBrush() once, perhaps in the constructor. Then just set hbr to that brush handle. In the destructor, be sure to delete that brush handle.
|
|
|
|
|
As prcarp syas, you rcurrently creating a new brush everytime the function is called. Where is this GDI resource being returned to windows? Its up to you to clean it up.
As you dont actually use it yourself, you should make hbr a class member. Call CreateSolidBrush() in your calss constructor and DeleteObject() on it in the destructor.
This should stop you leaking GDI resources.
If you vote me down, my score will only get lower
|
|
|
|
|
Thanx folks - My Bad
I was under the assumption that Win would clean that up itself, there I go assuming before thinking again...
|
|
|
|
|
Advanced thanks for the suggestion that you are going to give me
I am running a service that has the functionality of tracking the user log-off. Currently in the service i have a window that captures the WM_ENDSESSION message from windows O/S and i am logging it as a user "log-off event" ,this works fine as long as no activity is done to stop the logoff .In the case when logoff proceeds and an open document is prompted to be saved and the user cancels it, the logoff is also cancelled. In such a situation, according to my current logic, the "Log-off" event is logged which is improper.
Can you please help me with a suggestion for capturing the user log-off event only when the user actually logs off.
|
|
|
|
|
Windows first sends the WM_QUERYENDSESSION message to all applications. If all of the applications respond with a non-zero value, Windows will then send the WM_ENDSESSION message. If any application responds with a 0 to the WM_QUERYENDSESSION message (e.g., document not saved), Windows does not end.
You might also look at the ISensLogon interface.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Since some days the debug build of my application crashes when calling the close() and requery()
members of CDaoRecordset and when deleting all recorsets of a table in a loop, the call of delete for the last recordset crashes. Stepping into the MFC code shows that it always occurs at the same place in some code for the DFX mechanism. Since it's the same problem on all my three machines and it appeared "over night", I don't think that it is a bug in MFC. The only changes on all three machines are several service packs/security patches applied from our pc-support guys, so I think the problem is within the MS JetEngine which perhaps was affected by applied patches.
So what would you do now ???
MS
|
|
|
|
|
Manfred Staiger wrote:
Since some days the debug build of my application crashes when calling the close() and requery()
members of CDaoRecordset and when deleting all recorsets of a table in a loop, the call of delete for the last recordset crashes. Stepping into the MFC code shows that it always occurs at the same place in some code for the DFX mechanism. Since it's the same problem on all my three machines and it appeared "over night", I don't think that it is a bug in MFC. The only changes on all three machines are several service packs/security patches applied from our pc-support guys, so I think the problem is within the MS JetEngine which perhaps was affected by applied patches.
So what would you do now ???
1: All Database operations should be enclosed in try catch statements. There are a number of reasons why a data connection could fail and cause your app to crash. For starters make sure its still open before attempting to close it.
2: Why loop through an entire table to delete all of the records? A Delete query is much faster.
3: What versions of jet where you using? What versions are you using now?
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
sfdougl wrote:
1: All Database operations should be enclosed in try catch statements. There are a number of reasons why a data connection could fail and cause your app to crash. For starters make sure its still open before attempting to close it.
That's right, but doesn't solve my problem.
sfdougl wrote:
2: Why loop through an entire table to delete all of the records? A Delete query is much faster.
Of course I don't loop the entire table to delete the recordsets. I only wanted to describe that the Delete() call crashes at the last recordset when you do so.
sfdougl wrote:
3: What versions of jet where you using? What versions are you using now?
Unfortunately I don't remember if it has changed. I'm now looking for a PC with an older jet version as the one I have on my machine.
MS
|
|
|
|
|
1: Okay, so what specific error are you receiving?
2: Are you making sure that you have not gone past EOF? Or attempting to delete a record that does not exist?
Source Code and Errors received would greatly expedite the process.
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
sfdougl wrote:
1: Okay, so what specific error are you receiving?
There is no exception thrown. A dialog comes up saying "User breakpoint called from code at 0x778813b1". The output window of the editor shows the following messages:
HEAP[TestApp_g.exe]: Heap block at 038C8940 modified at 038C8998 past requested size of 50
sfdougl wrote:
2: Are you making sure that you have not gone past EOF? Or attempting to delete a record that does not exist?
Yes, absolutely. Everything worked fine for more than 2 years and when I make a release build it also works fine.
I made a small example which crashes as described, and works fine as release build.
//CTestClass is derived from CDaoRecordset
//m_nDefaultType member is set to dbOpenDynaset in the constructor
//m_pDatabase member is set to an open database (which contains the table "TestTable")
void CTestClass::DeleteWithLoop()<br />
{<br />
int counter=0;<br />
this->Open(AFX_DAO_USE_DEFAULT_TYPE, "TestTable", 0);<br />
if(!this->IsEOF())<br />
{<br />
while(!this->IsEOF())<br />
{<br />
counter++;<br />
this->Delete();
this->MoveNext();<br />
} <br />
}<br />
this->Close();<br />
}
In the meantime I'm quite shure that it's a bug in the jet engine.
MS
|
|
|
|
|
Sorry it took so long for me to get back to you. I'm on an odd schedule.
1: Good question, I don’t have a clue here.
2: The problem most probably isn't the delete statement but the MoveNext() if you delete the last record and attempted to move to a record that doesn’t exist an error occurs. I have had the same problem. Perhaps, the newer DAO version is stricter about such operations.
When you get a chance can you find out what version of DAO your using? Have any workstations that where not updated?
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
Hi all,
I search the size of the childframe border from a mfc view.
I've saved the size and the coordinates to the registry. I use this size to split the view in four equal section.
But doesn't work, because I've not subtract the frame border.
Can anyone tell me the right border sizes from a childframe.
Jens
|
|
|
|
|
Call GetSystemMetrics() (with the appropriate parameter for the border that you are interested in) on the childframe in question.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|