|
Dumping objects ->
strcore.cpp(118) : {93} normal block at 0x01222E40, 52 bytes long.
Data: < ' ' C:\C> 01 00 00 00 27 00 00 00 27 00 00 00 43 3A 5C 43
C:\Code\FtServer\FtThread.cpp(17) : {91} client block at 0x01222F40, subtype 0, 168 bytes long.
a CFtThread object at $01222F40, 168 bytes long
Object dump complete.
I'm unsure what strcore.ccp is... not sure if this helps.
Any ideas?
|
|
|
|
|
strcore.cpp needn't concern you:- MFC internals. The useful part of that dump is the line:-
a CFtThread object at $01222F40, 168 bytes long
tells you what it was.
Signature space for rent. Apply by email to....
|
|
|
|
|
strcore.cpp is the guts of CString.
As you can see, the leaked memory even contains fragments of your string.
But this is not CStrings fault, it simply gets no opportunity to clean up.
|
|
|
|
|
The best way to kill a thread is asking it to finish and wait for its end. A way to to this could be to implement a specific message send by the app to the thread.
(m_pMyThread is the pointer you get from AfxBeginThread
WM_STOPTHREAD defined as WM_APP + 1)
In the application:
<code>
// asking the thread to end
m_pMyThread->PostThreadMessage(WM_STOPTHREAD, 0, 0);
MsgWaitForMultipleObjects(1, &(m_pMyThread->m_hThread), TRUE, INFINITE, QS_ALLEVENTS);</code>
In the thread
<code>BEGIN_MESSAGE_MAP(CMyThread, CWinThread)
ON_THREAD_MESSAGE(WM_STOPTHREAD, OnStopThread)
END_MESSAGE_MAP()</code>
<code>LRESULT CMyThread::OnStopThreadClip(WPARAM wParam, LPARAM lParam)
{
// cleaning data here
AfxEndThread(1);
return 0L;
}</code>
HTH,
K.
<font size=0>
Some of those that work forces
Are the same that burn crosses !
Killing In The Name/Rage Against The Machine
</a>
</font>
|
|
|
|
|
How can I find out if I'm in print preview mode in my main frames OnClose()?
I've tried checking the DC IsKindOf for CPreviewDC, but couldn't get a positive result (am I using the DC incorrectly?) like this:
CDC* pDC = GetDC();
if (pDC && pDC->IsKindOf(RUNTIME_CLASS(CPreviewDC)))
if (pDC)
ReleaseDC(pDC); And I've also tried checking for difference's in the hDC's without joy:
CDC* pDC = GetDC();
if (pDC && pDC->m_hDC != pDC->m_hAttribDC)
if (pDC)
ReleaseDC(pDC); Anyone know how I can find out if I'm in print preview in my CMainFrame::OnClose() ??
Dylan Kenneally
London, UK
|
|
|
|
|
From the top of my head: override CFrameWnd::OnSetPreviewMode. Never did that, however
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Works a treat, thanks very much
Dylan Kenneally
London, UK
|
|
|
|
|
I am doing my win32 application.How to dynamically increase scroll bar size
of a window.
|
|
|
|
|
Do you create your scrollbars by adding WS_HSCROLL or WS_VSCROLL window style, or it's a child control?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Hi,
I have 2 Tables on MS-Access and I use 1 class CRecordSet because these tables are joined. I have no problem to read a recordset like this:
rsMsg.m_strFilter.Format("CLE = %d", lCle );
rsMsgExp.Open( CRecordset::snapshot,_T("Proc"));
if(!(rsMsgExp.IsEOF() && rsMsgExp.IsBOF()))
{
rsMsgExp.MoveFirst();
csToto = rsMsgExp.m_TOTO;
But when I don't want to write (Add or Update a record), it's not possible, the Exception is "Record is on Read Only Mode", why ???????
Thanks a lot ....
|
|
|
|
|
Snapshots are not updateable. BTW: why don't you use CDaoRecordset instead of ODBC-based CRecordset if you're using Access?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
|
So use CDaoRecordset and open it as 'dynaset', not 'snapshot' - pass dbOpenDynaset to CDaoRecordset::Open.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Hi,
I have a problem with the COleDateTime class. I have no idea how to do subtraction and addition for two COleDateTime objects. I am used to the VB type of time and date addition and subtraction. Is there a way to do subtraction and addition as in VB date/time?
By the way is there an equalvalent date/time method in VC that is similar to the one in VB?
Your help is greatly appreciated.
leonwoo
|
|
|
|
|
Look at the COleDateTimeSpan class and operators +,-,+= and -= defined in COleDateTime.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Im using dinput.h's GetDeviceState to retrieve the
current mouse cursor position.
Why do I get coordinates returned in the billions???
I get the same result using ints and longs for x&y.
All I want are pixel coordinates within the
range of my window app.
Any help would be much appreciated
Thanks,
Rob
|
|
|
|
|
Says MSDN-
> The mouse is a relative-axis device, so the absolute axis positions for mouse axes are simply accumulated relative motion. Therefore, the value of the absolute axis position is not meaningful except in comparison with other absolute axis positions.
Why don't you just handle WM_MOUSEMOVE events instead? Potentially with a SetCapture() first.
Signature space for rent. Apply by email to....
|
|
|
|
|
As far as I know, GetCursorPos() works very well, this gets your position in screen coordinates, you can use ScreenToClient() after that.
Romeo JUNCU
|
|
|
|
|
hi,
the template was not recognized, in my MFC DLL.
typedef struct
{
CString name;
int age;
}MYSTRUCT;
CList<MYSTRUCT,MYSTRUCT&> myList;
what's wrong then?
Extreme programming. Do the No.1
|
|
|
|
|
I believe you must export your struct from your extension dll. Use AFX_EXT_CLASS macro
Best regards,
Alexandru Savescu
|
|
|
|
|
I've created a dialog based multithreaded application in VC++ 6.0. The problem is that, whenever i close my application in "release" build, the memory error appears. I am unable to discover the problem because this error is not appearing in debug build. Can any one suggest me something ???
The error i am getting in release build while closing application is:
The instruction at "0x004165a3 referenced at 0x00000078. The meemory could not be "read"
|
|
|
|
|
http://www.codeproject.com/debug/
or more precisely:
http://www.codeproject.com/debug/survivereleasever.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I had a very similar experience. In my case, I forgot to fill the iSubItem field of a LVITEM structure. In debug mode, this field is filled with 0xcccccccc or something, but in release builds, it's filled with whatever happens to reside in that memorylocation previously...
If it's not a LVITEM struct, check if you aren't forgetting to initialise a variable somewhere. An overlooked boolean can be enough to crash the program... (happened to me 4 days ago...)
I used this to find the bug:
extern void SendToDebugFile(const char* comment,bool bNew=false)<br />
{<br />
FILE* f;<br />
if(bNew)
f=fopen("Debug.txt","w");<br />
else
f=fopen("Debug.txt","a");<br />
if(f)<br />
{
fprintf(f,"%s\n",comment);<br />
fclose(f);<br />
}<br />
};
Just call this function at specific locations:
SendToDebugFile("Start of function",true);<br />
...<br />
SendToDebugFile("Marker 1");<br />
...<br />
SendToDebugFile("Marker 2");<br />
...<br />
SendToDebugFile("End of function");
The bug will occur between the last marker in the file and the next one. Zoom in on it with more markers.
|
|
|
|
|
You could even rewrite the TRACE macro so it would expand into a call to SendToDebugFile in release builds!
BTW, statements in ASSERT or TRACE macros that gets expanded into void in release builds is a common source of release-doesn't-work bugs. Another is incorrect signatures of message handlers (if you use VC++6.0).
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Why not redirect the standard output (stdout) streaming in a file (output.txt)...
For that, add a Program argument:
=> in your projects setting (in release mode)
=> tab "Debug"
=> category "general"
=> and Program argument = ">output.txt 2>&1"
Now you can use printf("All what you want\n") for debugging your app and the output.txt file catch your stream...
Hello World!!!
from Raphaël
|
|
|
|