|
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
|
|
|
|
|
I have solved this problem :
i had to write this :
SetForegroundWindow();
m_menu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTBUTTON ,pt.x,pt.y,this);
PostMessage(WM_NULL,0,0);
instead of only writing
m_menu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTBUTTON ,pt.x,pt.y,this);
m0n0
|
|
|
|
|
Hi all,
I'm working in an application that has a main dialog and a CPropertySheet embedded in it. The tab order between the dialog and the CPropertyPages works fine so I can pass the focus through all the controls of the application perfectly. When I insert an OCX component inside a PropertyPage (I need this OCX to communicate with an another device) the tab order between the main dialog and the CPropertySheet fails: when the focus enters into a PropertyPage the focus cannot return to the main dialog and remains inside that propertypage.
Any ideas of what's happening?
Marc Soleda
|
|
|
|
|
Anybody can tell me what this for below:
pnl_btn::draw2..
pnl_btn::draw...
edit ....
10..pnl_edit::draw..
pnl_inp::draw...
pnl_lst::draw...
pnl_lst::draw_highlight_bar.
message panel
pnl_msg::draw
pnl_msg::render_to_image_buffer
%s.bmp
pnl_pic::draw
pnl_scbr::draw
pnl_txt::word_wrap_append
pnl_txt::draw
pnl_txt::draw_background2
pnl_txt::draw_background
pnl_txt::draw_border
pnl_txt::get_text_rect
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
|
within EXE file of a game
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
ohhhh ohhhh, ok, i see what you mean
you are not on the right forum actually, 'cause you are talking about managed code generated for .NET Framework...
in fact, what you extracted (certainly with ldasm.exe) describe the declarations, but i can't say more till there's not the rest of the code...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
managed code generated for .NET Framework...
What do you mean??
do you want me to send u more code stuff.
You know that the idea is I wanted to know "what function calls a chat message box" within this exe file
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
i just say that you can't find such code lines in an exe file unless it is compiled for the .NET framework...
how did you get these lines ? with ldasm.exe , didn't you ?
where does the code you extracted come from ?
hemm, do you know .NET framework ???
if not, do you code under Visual Studio 6 (or previous) or 2003/2005 ?
what kind of solution do you compile for ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I used 010 editor this programe 010 Editor "is a powerful hex editor designed to quickly and easily edit binary files."
No I do not know .NET framework!
I'am trying to learn Visual C++ version 6.0
HERE is some things I found in 010 editor
--------------
GetKeyState
PostQuitMessage
KillTimer
SetWindowTextA
SetCapture
ReleaseCapture
GetCapture
SetWindowLongA
PostMessageA
GetActiveWindow
WinHelpA
ClientToScreen
DSetRect
MessageBoxA
(SetCursorPos
CGetSysColor.K.SetSysColors..V.GetWindowLongA...MessageBeep...GetFocus....MoveWindow....CallWindowProcA...DrawTextEXA...GetCaretBlinkTime.<.CloseClipboard...IsClipboardFormatAvailable....DrawTextA...getForegrundWindow...GetAsyncKeyState....GetKeyboardState..USER32.dll..S.DeleteObject..%.GetDeviceCaps.U.GetTextMetricsA..SelectObject..7.CreateFontIndirectA.
Note: "..." indicate hex 00 00 00
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
wow, you're far from you goal buddy
you won't find what you expected like this !!!
what you see is effectively the functions called from the program, but these are only graphics ; and even if you find class member functions, what will give you the context it is used actually ?
the only thing i can assure you with that code, is that it is written with MFC !!!
and that's all !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
If it is written with MFC !!!
What are the function I should look for that trigger chat dialog box
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
hey, i know i don't speak english very well, but i wonder if you just understand english too...
i said that you CANNOT find such information like this (i.e. decompiling an exe).
you want to find out how to make a chat dialog box ? google for that subject ; you will find more efficient answers that what we talk here, and than what you do with that poor exe...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hey toxcct:
I believe that your poor English is what made me to be confused. I tried to follow what you wrote in all previous messages and found out that you asked too many questions not related to the original thread which led us to a ded wall. I sugest.. when you try to reply to a subject please stick to content of the subject.
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|
|
looks like classes and methods for a drawing program of some sort .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
pnl_lst::draw_highlight_bar.
message panel
------------------
is this means to draw a message sort of thing
After all, Today is the Tomorrow you worried about Yesterday
|
|
|
|