|
What is the value of m_edit::m_hWnd before the call to m_edit.SubclassWindow()? m_edit is not allowed to have an window already attached to it before calling SubclassWindow.
Look up CWnd::SubclassWindow in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
yes, you are correct.
As my previous post said, I shouldn't call m_edit.Create() in the initialization routine, that cause the assertion failure.
Thank you!
|
|
|
|
|
Hi!
I want to get the main icon of an EXE and then change the main icon of another EXE with the one I got!
How can I implement it?
Thanks!
|
|
|
|
|
Do you mean by actually modifying the .exe file? If so, check out BeginUpdateResource() and UpdateResource(..., RT_ICON, ...) .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex.
The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper.
Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running.
Here's the part of "regexp.h" in FreeLing.
The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line.
<br />
private: <br />
<br />
void clone(const RegEx &y) {<br />
size_t size;<br />
if (!y.re) return;<br />
<br />
pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size);<br />
re=(pcre*) new char[size];<br />
if (!re) {<br />
throw "not enough memory";<br />
} else {<br />
std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl;<br />
}<br />
memcpy(re, y.re, size);<br />
<br />
pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);<br />
pe = (pcre_extra *) new char[size];<br />
<br />
if (!pe) throw "not enough memory";<br />
memcpy(pe, y.pe, size);<br />
<br />
substrcount = y.substrcount;<br />
ovector = new int[3*substrcount];<br />
matchlist = NULL;<br />
}<br />
And the error in pcre_fullinfo(); in PCRE.C is below.
On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE";
<br />
int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) {<br />
const real_pcre *re = (const real_pcre *)external_re;<br />
const pcre_study_data *study = NULL;<br />
<br />
if (re == NULL || where == NULL) return PCRE_ERROR_NULL;<br />
if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;<br />
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0)<br />
study = extra_data->study_data;<br />
<br />
switch (what) {<br />
case PCRE_INFO_OPTIONS:<br />
*((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break;<br />
<br />
case PCRE_INFO_SIZE:<br />
*((size_t *)where) = re->size; break;<br />
<br />
case PCRE_INFO_STUDYSIZE:<br />
*((size_t *)where) = (study == NULL)? 0 : study->size;<br />
break;<br />
<br />
I'm using VS.NET 2003 and the error-popup say "
Unhandled exception at 0x0053d42d in TestFreeLing.exe: 0xC0000005: Access violation reading location 0xabababab.
I've try to navigate and understand the code for a week. But I don't know how to figure it.
Anybody please help me solve this problem.
Thank you very much.
|
|
|
|
|
More information on the Call Stack under debug
It seem that error is from the "study" variable, which is of "pcre_study_data" type.
<br />
- re 0x00324278 {magic_number=0x50435245 size=0x0000005e tables=0x00737140 "" ...} const real_pcre *<br />
magic_number 0x50435245 unsigned long<br />
size 0x0000005e unsigned int<br />
+ tables 0x00737140 "" const unsigned char *<br />
options 0x00000010 unsigned long<br />
top_bracket 0x0001 unsigned short<br />
top_backref 0x0000 unsigned short<br />
first_byte 0xcdcd unsigned short<br />
req_byte 0xcdcd unsigned short<br />
name_entry_size 0x0003 unsigned short<br />
name_count 0x0000 unsigned short<br />
- study 0xabababab {size=??? options=??? start_bits=0xabababb0 <Bad Ptr> } const pcre_study_data *<br />
size CXX0030: Error: expression cannot be evaluated unsigned int<br />
options CXX0030: Error: expression cannot be evaluated unsigned char<br />
+ start_bits 0xabababb0 <Bad Ptr> unsigned char [32]<br />
|
|
|
|
|
The address 0xabababab indicates a memory following a block allocated by LocalAlloc().
Means that you are stepping (wayyy) outside of your memory block
Try setting a conditional break point on when the variable study change
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm trying to watch the variable and set the breakpoint, but I have no idea where to figure out!!. The only thing I would suggest is the variable "study". Any clue/hint?
|
|
|
|
|
In my MDI App that has 4 views ,I want to load a different toolbar for each view
In my Initinstance function I have all the templates sharing the same ChildFrame ?
Engineering is the effort !
|
|
|
|
|
Create all your toolbars when you create the main frame, then use CFrameWnd::ShowControlBar to hide the toolbars you don't want visible and show the ones you do.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hello,
Hello, MSDN says
this[^] about _CrtIsValidHeapPointer
I use that function to verify that an address is not valid after a function call. The only problem is that this function jumps into the debugger when it finds out that the address is not valid. So this function returns TRUE or it jumps into the debugger and never returns FALSE, which is exactly what I need..
Is there some alternative of this function that does return FALSE instead jumping into the debuffer?
Blog[^]
|
|
|
|
|
You can find the code in dbgheap.c under \crt\src
see what can be done
It mainly uses IsBadReadPtr, IsBadWritePtr and HeapValidate or __sbh_verify_block depending on the OS and if the CRT is statically or dynamically linked
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks, That worked!
Blog[^]
|
|
|
|
|
I created a static splitter window with two horizontal panes. The first pane is derived from CView and the second from CScrollView. I defined the menu function in the second pane's view class. but the control doesnt reach thr. What could be the problem . Can any1 pls help me?
|
|
|
|
|
Hi all,
Does anyone know of any filmstrip controls (commercial or free)?
I need to display video in my app, together with preview frames of the previous two and next two frames.
Cheers
--
The Obliterator
|
|
|
|
|
When I try clean dynamic memory using delete[] operator, message
"Unhandled exception at 0x77f767cd in SDIStart.exe: User breakpoint." appears.
What can cause the exception?
Thanks a lot.
|
|
|
|
|
evgumin wrote:
What can cause the exception?
many things... give us the portion of crashing code please...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
There is a peace of code:
void TStationArray::InitCollection()<br />
{<br />
CMegaBase base;<br />
CDBVariant** var;<br />
base.Query.Format("select STATIONNO from STATION order by STATIONNO");<br />
if ( base.MakeSelectVar("", &var)!=-1 )<br />
{<br />
for (int i=0; i<base.n; i++)<br />
{<br />
Stationno stno = var[i][0].m_iVal;<br />
collection.push_back( new TStation(stno) );<br />
stationnoset.insert(stno);<br />
}<br />
}<br />
<br />
if (var!=NULL)<br />
{<br />
for (int i=0; i<base.n; i++)<br />
delete[] var[i];
delete[] var;<br />
}<br />
<br />
UpdateCollection();<br />
}
This is a static method of the class TStationArray. Memory is occupied in calling base.MakeSelectVar("", &var). I reprsent this method below.
int CMegaBase::MakeSelectVar (CString query, CDBVariant ***vIn)<br />
{<br />
CDBVariant **v;<br />
v = NULL;<br />
CDatabase cdbMyDB;<br />
CRecordset recSet;<br />
<br />
if (query=="") query=this->Query;<br />
<br />
try<br />
{<br />
cdbMyDB.Open(server, FALSE, FALSE, initStr, FALSE);<br />
if (cdbMyDB.IsOpen ())<br />
{<br />
recSet.m_pDatabase=&cdbMyDB; <br />
recSet.Open (CRecordset::snapshot, query, CRecordset::readOnly );<br />
if (recSet.IsOpen ())<br />
{<br />
int i=0,j;<br />
while (!recSet.IsEOF())<br />
{<br />
recSet.MoveNext();<br />
i++;<br />
}<br />
n=i;<br />
m=recSet.GetODBCFieldCount ();<br />
<br />
if (n!=0){<br />
v = new CDBVariant*[n];<br />
}<br />
if (!recSet.IsBOF())<br />
{<br />
recSet.MoveFirst();<br />
}<br />
<br />
i=0;<br />
while (!recSet.IsEOF())<br />
{<br />
v[i]=new CDBVariant[m];<br />
<br />
for (j=0; j<m; j++) <br />
{<br />
recSet.GetFieldValue (j, v[i][j]);<br />
} <br />
recSet.MoveNext ();<br />
i++;<br />
}<br />
}<br />
recSet.Close ();<br />
}<br />
cdbMyDB.Close ();<br />
}<br />
catch (CDBException *err)<br />
{<br />
AfxMessageBox (err->m_strError +recSet.GetSQL ());<br />
return -1;<br />
}<br />
catch (CMemoryException)<br />
{<br />
AfxMessageBox ("memExcept");<br />
}<br />
<br />
if (vIn!=NULL) {*vIn=v;}<br />
pVar=v;<br />
<br />
return 0;<br />
}
Thanks for your help.
|
|
|
|
|
try using std::vector and boost::shared_ptr
and not CDBVariant ***vIn
|
|
|
|
|
"Unhandled exception at 0x77f767cd in SDIStart.exe: User breakpoint."
You can see debug output there should be some explanation why that happened.
Any way it seems some heap corruption occured.
You can use Page Heap OS feature to try to catch where this corruption happens.
To enable this feature you should use Global Flags Editor.
Also you can take a look to this article http://www.codeproject.com/debug/cdbntsd3.asp[^]
See http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/b6af1963-3b75-42f2-860f-aff9354aefde.mspx[^]
for more information about gflags utility.
To enable Page Heap and other debugging features without gflags.exe utility
add to the registry the following entries:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\SDIStart.exe]
"GlobalFlag"=dword:103099f3
"VerifierFlags"=dword:000d3ff7
"PageHeapFlags"=dword:00000003
That works for Windows XP
These settings will catch allocated memory overrun.
Windows XP also can provide memory underrun.
I always debugging my programs using this feature.
WBR
Henry
|
|
|
|
|
Firsts things that comes in mind:
- did you allocate the memory with new[] and not with new ?
- Try to see if somewhere in your code you don't write outside the borders of your allocated memory...
But, as toxxct said, post the code, this will help us a lot.
|
|
|
|
|
I use new[] and delete[].
Please, explain what you intended in the second advice.
And I represented the code in the answer to toxxct.
Thank you.
|
|
|
|
|
Hi everybody ,
I have an application with a tray icon and i have a popup menu , which pops up when the user right clicks on the tray icon.My problem is that when the popup menu is displayed it does not disappear until i click on any of the items.
For example if the popup menu is displayed and i click , for example on start button or anywhere else except the popup menu client area, the popup menu still remains...and i want that it dissapeared like the normal popup menu does.
Can anybody help ???
Thanks in advance
m0n0
|
|
|
|
|
Try giving SetForegroundWindow() before TrackPopupMenu
« Superman »
|
|
|
|
|
I've done it but it did not help
...
m_menu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON,pt.x,pt.y,this);
PostMessage(WM_NULL)
...
thanks anyway ,
now i added also SetForegroundWindow() function and now it works
|
|
|
|