|
|
I am permanently logging lines of text with a "\r\n" at the end to a CRichEditCtrl. That way, the CRichEdit appends a new line of text with every call of ReplaceSel("SomeText\r\n") and keeps scrolling down. Stupidly the whole thing gets very sluggish as the amount of text increases. I saw applications doing this kind of "logging" for several hours without getting slower. Does anybody have an idea how to do this ???
MS
|
|
|
|
|
I use a listbox and add lines to the end of the list.
John
|
|
|
|
|
I have a problem I have been scratching my head on for a few hours now. I have a class in a project which has not changed in 6 months, but when I came to build the whole project this morning I got about 22 errors in it to do with some friend functions for serialzation trying to access a protected member variable.
#ifdef _DEBUG
friend CDumpContext& AFXAPI operator<<(CDumpContext& dc, CGoodTime time);
#endif
friend CArchive& AFXAPI operator<<(CArchive& ar, CGoodTime time);
friend CArchive& AFXAPI operator>>(CArchive& ar, CGoodTime& rtime);
#pragma message(" GoodTime.h")
protected:
void SetDays( tm *ptm );
private:
tm m_time;
};
The actual implemenations of these functions throw up the compile errors. Now I have added in a #pragma message command to make sure the correct header is being used, and it is. So the next thing I tried was the compiler /P option to get a copy of the output that goes into the compiler, needless to say with the /P option it compiles without any problems, remove /P and they come back.
Any ideas why this should be so?
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Roger Allen wrote:
...with the /P option it compiles without any problems, remove /P and they come back. Which is to be expected, as the /P switch does not do any compiling, but just sends the preprocessor output to a file.
I know this does not solve your problem, but I just wanted to clarify in case you were expecting something that was not meant to happen.
|
|
|
|
|
DavidCrow wrote:
the /P switch does not do any compiling, but just sends the preprocessor output to a file.
OK, that explains one thing. The docs don't say that /P stops the compiler form compiling.
Anyway, I have done some more tests here and the project builds on a different PC with teh same VC version etc, so it seems to be down to some local configuration setting.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Roger Allen wrote:
The docs don't say that /P stops the compiler form compiling.
Actually, the documentation clearly states that this option suppresses compilation.
|
|
|
|
|
DavidCrow wrote:
Actually, the documentation clearly states that this option suppresses compilation.
Well, my docs in this case was not the MSDN, but John Robbins:Debugging applications. I remebered reading about the switch and looked it up there. Needless to say he has a slight cut down version of the info in his book.
Just means I need to check in all the sources available. Anyway, I have tracked the problem down to an include file causing the problem, not sure what part of it yet.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
void CFrameworkDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
switch (nIDEvent) {
case IDC_Timer:
{
KillTimer(IDC_Timer);
if(!SetTimer(IDC_TIMER_CHECKUP_THREAD,50,NULL))
DestroyWindow();
FunctionStart();
break;
}
case IDC_TIMER_CHECKUP_THREAD :
{
if (!FuncEndupTest())
UpdateData(FALSE);
break;
}
}
CDialog::OnTimer(nIDEvent);
}
//----------------------------------------------------------------------------
//Procedure:
// FunctionStart(void)
//Description:
// Entry point for each function
//Input:
// None.
//Output:
// None.
//
void CFuncDlg::FunctionStart()
{
m_hFunThread = CreateThread(NULL,0,
(LPTHREAD_START_ROUTINE)funclist[m_nCurFunc],
m_ptr,0,
NULL);
}
//----------------------------------------------------------------------------
//Procedure:
// FuncEndupTest(void)
//Description:
// Check if function is finished
//Input:
// None.
//Output:
// true or false
//
bool CFuncDlg::FuncEndupTest()
{
DWORD dwExitCode;
while (WaitForSingleObject(m_hFunThread,0)==WAIT_OBJECT_0) //The state of the specified object is signaled.
{
GetExitCodeThread (m_hFunThread,&dwExitCode); //This function retrieves the termination status
//of the specified thread
CloseHandle(m_hFunThread);
m_nCurFunc++; //A abnormal handle section
if(m_bStopOnFristError&&!(dwExitCode&0xff))
{
for(int i=m_nCurFunc;i<m_nfunccount;i++)
="" logresult(stoponfirsterror);
="" sendmessage(m_hptr,="" wm_close,0,="" 0);
="" return="" true;
="" }
="" decide="" whether="" all="" the="" functions="" have="" complished,="" and="" do="" some="" handle="" actions
="" if(m_ncurfunc<m_nfunccount="" )
="" functionstart();
="" else
="" false;
}<="" small="">
|
|
|
|
|
I do not understand your question. However If you want to know how to run the code that you give the problem is that it is not a complete program. It is MFC code but you need the rest of the code and resources to compile it.
John
|
|
|
|
|
By "run the codes" do you mean "how to compile the code?"
|
|
|
|
|
This is a multi-thread programming. I list only the main codes not all.
I want to know the progress of performing.
Sorry, my English is not good.
Thanks.
|
|
|
|
|
The "process of performing" what?
|
|
|
|
|
When the executable file are executed there are several steps: for example,
first run to line 34, then line 55-78 are executed, after this a function block are executed, ..., at last the window is destroyed. Of course, there maybe are some messages to be handled during the time.
I want to know the function's inter-calling way.
Sorry, I have confused you.
|
|
|
|
|
Hi All,
I am developing an application for Windows 2000/XP using VC++.I want to make a complete copy of
"Current Controls Set" in my application. (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet) to
another key in HKEY_LOCAL_MACHINE.
For copying the key I referred http://www.codeproject.com/system/registrykeycopy.asp code.
The program is working perfectly fine. But when i try to copy the CurrentControlSet key, it
copies all the keys except the "Enum key".
I think there is some security reason behind this. If this is so, then can anybody please suggest
a way to copy this key also.
Or alternatively is there any other way to copy this whole key including Enum key.
Please suggest!
Rohit
|
|
|
|
|
On many XP machines, our software is displayed with its view’s truncated. I have looked at the Control Panel / Accessibility Options and everything seems correct. (No vision related properties are checked.)
I can correct the problem by running the Accessibility Wizard. I just run the Wizard, clicking on NEXT for everything – I change no options. This process fixes the problem 100% of the time.
My guess is this process of running the Accessibility Wizard is doing something to the registry. But what is it doing? How can I find out what the Wizard does?
Thanks
|
|
|
|
|
Hello all,
This should be real simple, just don't know where to start. Basically I need to create from an application a web page and post it on my web site. How can I do this?
thanks
Ralph Krausse
|
|
|
|
|
Hello everybody,
Here is my problem.
I'm trying to display a dialog and in the Create() function I'm getting an assert error. I dig up through the debugger and I found out where I'm getting the assert error is in AfxGetResourceHandle(). Here is my code:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CMainDlg *mainDlg = new CMainDlg();
BOOL bRet = mainDlg->Create(IDD_MAIN_DIALOG, NULL);
if (bRet != 0)
{
mainDlg->ShowWindow(SW_SHOW);
}
else if(bRet == 0)
{
AfxMessageBox("Error Creating Dialog");
}
return 0;
}
As you noticed, all I'm trying to do is to display a dialog. Is there anything that I have to set in advance before I create the dialog and display it? Any answer is more than welcome.
Best regards,
Luis E. Cuadrado
)
|
|
|
|
|
It has been a long time since I have done MFC, but since you have replaced MFCs WinMain, it has been unable to initialize.
What you should have done is display your dialog from the InitInstance method of your CApplication class.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Have you stepped through the Create() code to see why afxCurrentResourceHandle is still NULL?
|
|
|
|
|
Hi DavidCrow,
Yes, I stepped through the Create() code. The assertion is comming in the AfxFindResourceHandle() function. I included the portion of the code where the assert error comes and I pointed out where the assert error occurs. Aparently the value pModuleState->m_bSystem returned by AfxGetModuleState() is causing the assert error. Here is the code.
HINSTANCE AFXAPI AfxFindResourceHandle(LPCTSTR lpszName, LPCTSTR lpszType)
{
ASSERT(lpszName != NULL);
ASSERT(lpszType != NULL);
HINSTANCE hInst;
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
if (!pModuleState->m_bSystem)
{
hInst = AfxGetResourceHandle();
if (::FindResource(hInst, lpszName, lpszType) != NULL)
return hInst;
}
.
.
.
I hope this helps. Before I forget, thanks for your reply David
Luis E. Cuadrado
)
|
|
|
|
|
Technically, the assertion is being fired within the inline function AfxGetResourceHandle(), which, in this case, is being called by AfxFindResourceHandle(). Have you tried Tim's suggestion? I've never tried creating an MFC application without the other supporting pieces in place.
|
|
|
|
|
I'm going to try Tim's suggestion. As soon as I find something, I will post back the results.
Thanks for your replys.
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
Simple. In order to use MFC you must initialise it first.
if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
return 1;
}
Then your MFC operations will work as normal . You don't need to call any cleanup functions at the end.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I use SHChangeNotifyRegister api to monitor the filesystem notification.
But I find when I copy a lot of files(>=20),The number of the posted notification: SHCNE_CREATE not equals to the number of the files. the Shell allways post about 10 SHCNE_CREATE notification, then follow a SHCNE_UPDATEITEM notification, This is not the acion I need.
Does anything wrong. But If the number of files to copy is less than 10,All is right.
How to do? help!!!
|
|
|
|