|
I'm currently writing a very simple HTML colour highlighting Rich Edit control extension (inheriting from CRichEditCtrl).
The control works perfectly in a debug build, behaving exactly as designed. However, in a release build no colourising takes place.
As a background the following code is used to get a particular line of text from the control to parse it:
CString strLineText;
int nRead = GetLine(nLineIndex, strLineText.GetBuffer(1024));
strLineText.ReleaseBuffer(nRead);
The line index is specified a sa parameter to the function. In the debug build this works fine. But in the release build, for some reason, GetLine returns 0 and strLineText is empty This means that the rest of the code has no text to work on and so nothing is colourised.
In case you were wondering, yes the text is actually there, it's just that GetLine isn't supplying it.
The text has been added using a CString member variable i.e.:
m_strHtml = _T("Some really long html file that runs over several lines");
UpdateData(FALSE);
m_ctrlRichEdit.ParseAllLines();
I have also tried using ReplaceSel , SetWindowText , and I've even tried using the clipboard. All approaches have the same effect.
Any thoughts?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
That is a funny one.
Is your GetLine method overridden? If so, check for obvious things like the method not being wrapped in #ifdef _DEBUG statements. Otherwise, try stepping into the statement (F11) to see exactly whats going on.
Failing that, I dunno, try using EM_GETLINE ??
Dylan Kenneally
London,UK
|
|
|
|
|
I haven't overridden GetLine . The only things it handles are ENM_CHANGE (registered using SetEventMask in PresubclassWindow and OnCreate ) and WM_CHAR .
Whilst trying to debug the problem I added several OutputDebugString calls in the OnChange handler. Bizarely enough if I output the window text in this call, the colourising succeeds becuase GetLine returns the correct text. I tried outputing smaller amounts of text thinking it may be timing related and found that it wouldn't work with anything less than half of the control text.
Even more bizarrely, following on from the timing thoughts, using Sleep or SetTimer to reparse the text after a specified time interval didn't work either. Even waiting for as long as 5 seconds.
It's really weird
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
I did a colorized java editor using a CRichEditCtrl a while back. It is of course just a dirty ol' hack , but if you want to have a look at it I can mail it to you.
|
|
|
|
|
You probably won't want to hear this... but I would advise you not to use the rich edit control for something complex like this (if it's part of a serious product that is).
We based our software product around this control and live to reget it.
It is quite buggy and as it is a part of the OS you don't have total control for distributing it with you App.
|
|
|
|
|
Hi all,
running my application under debug sometimes I receive this message "User Breakpoint called from code at 0x77f9f9df". When I run the application without debug the message is "...unknown software exception (0x0000003) in application at 0x77f9f9df".
The same error occurs when I press F12 running my application under debug.
My environment is Win2000.
Anyone know what it means, there is a solution?! Helpme please!
thanks and sorry for my poor english.
|
|
|
|
|
A 'user breakpoint' is an exception of your application. Probably, your exception should be an inconsistent pointer reference.
Debug your application, and concentrate your attention to your pointer values.
Regards,
---------------------
Pere Llibre
Software Engeneering
|
|
|
|
|
If I try to debug my application the error doesn't occurs!
|
|
|
|
|
XAlien wrote:
If I try to debug my application the error doesn't occurs!
That's the mystery of software development
Regards
Thomas
Finally with Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
Hi all,
From an exe called "whatever.exe" I call loadlibrary like this
HMODULE h_mod = LoadLibrary("mttool32.dll")
I receive a NULL value in h_mod. This is strange because whatever.exe resides in the same location as mttool32.dll and according to the docs LoadLibrary should search in the working/current directory.
I works fine calling it with an absolute path but I don't want to restrain my users to a specific location.
Any ideas why this is?
/Tommy
|
|
|
|
|
are you running your app from the dev environment (in debug or release mode) ? if you are the directory isnt what you think it is
just a thought
---
"all's fair in love and war but in love there's no geneva convention"
|
|
|
|
|
Hi Lauren,
In what way is the directory not what I think...? I tried to use LoadLibrary("mttool32.dll") both in Dubeg and Release mode and none of them works. But in both Debug and Release mode it works when supplying an absolute path... how come the directory is interpreted correctly just because the path is absolute?
I really need the relative path to function properly since people can install my software where ever they like... and having a hard coded path in my app is not a good thing... Well, good is mild; disaster I would call it.
/Tommy
|
|
|
|
|
Try pasting your DLL to the parent directory of both the Debug and the Release dirs.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Tommy,
The working directory will not always be the directory where the exe exists. When you run it from Visual Studio, the working directory will be the parent directory of the debug/release directories.
Use GetModuleFileName to get the path of your exe, remove the filename, add your dll name and voila, everything is fine again
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
So I can't have the dll in the same directory as the exe calling the dll without using GetModuleFileName? Strange...
Thx for your help AI bot!
|
|
|
|
|
How can I get the following SQL statement to take a string value after FROM.
SqlString = "SELECT * "
"FROM ?????";
The string name is strFolderOpen and this will hold the name of the Access database to open.
Thanks, Aoife
|
|
|
|
|
assuming SqlString is a CString:
SqlString.Format("SELECT * FROM %s",strFolderOpen);
or have i misunderstood the question?
---
"all's fair in love and war but in love there's no geneva convention"
|
|
|
|
|
Thanks a million Lauren, it works perfectly!!
|
|
|
|
|
Hi,
I am using Shell_NotifyIcon to have
my application in Task Status Bar.. Everything
is fine.. but when i exit my application.. (through a
Menu item (exit)..)
it is terminating with Error code of
37721 (0x8003)..
I have tried using EndDialog(IDOK) also..
My Dialog is Hidden and does not have any controls.
Can anybody help
Sameer
|
|
|
|
|
The proper way to close your application would be to sendmessage WM_CLOSE to the dialog.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hi,
This is the code i am using.. but now its giving me
Thread exit with error 0x2
NOTIFYICONDATA tnid;
// Remove the Icon from the TaskBar
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = GetSafeHwnd();
tnid.uID = 14;
Shell_NotifyIcon(NIM_DELETE, &tnid);
PostMessage(WM_CLOSE,0,0);
return;
The Error is
he thread 0xFFFA9B37 has exited with code 2 (0x2).
The program 'D:\RCMMS\Code\shnotify\Debug\shnotify.exe' has exited with code 2 (0x2).
Please help
|
|
|
|
|
Hi,
How can i Modify the "common" List Box text font size to a custom size ?
Thank's.
|
|
|
|
|
You just need to create a new font for the control. For example:
LOGFONT lf ;
CFont *pFont = GetDlgItem(IDC_LISTCONTROL)->GetFont() ;
if (pFont != NULL)
{
pFont->GetLogFont(&lf) ;
lf.lfHeight += 2 ;
}
else
{
}
m_Font.CreateFontIndirect(&lf) ;
GetDlgItem(IDC_LISTCONTROL)->SetFont(&m_Font) ;
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
My work often involves writing multi-threaded turnkey systems - ie. programs which are designed to run "for ever". As such the kind of memory leaks that are found by BoundsChecker - memory that is allocated but not released when the program terminates - are relatively unimportant. What does cause problems is when a thread, running as a continuous loop, allocates memory each time round the loop that it doesn't free. Over time the system floods until eventually a catastrophic failure occurs.
I need a way to monitor the heap usage of each individual thread, and detect whether it is leaking each time it executes its loop. (I know there is something called "thread-local storage" but I haven't been able to find much detail on it). If anyone knows any techniques for this, or can point me at some good articles or books, I'd be most grateful.
Dave
|
|
|
|
|
I had the same problems a year back and ended up writing a sort of collector where I registered all dynamically allocated objects (and general storage) an unregistered them on deletion. The collector was instanciated on the stack for each thread. When the thread exited, the collector printed information about all objects still not unregistered.
If there is a better way to do this, I also would like to know.
|
|
|
|