|
Since some days the debug build of my application crashes when calling the close() and requery()
members of CDaoRecordset and when deleting all recorsets of a table in a loop, the call of delete for the last recordset crashes. Stepping into the MFC code shows that it always occurs at the same place in some code for the DFX mechanism. Since it's the same problem on all my three machines and it appeared "over night", I don't think that it is a bug in MFC. The only changes on all three machines are several service packs/security patches applied from our pc-support guys, so I think the problem is within the MS JetEngine which perhaps was affected by applied patches.
So what would you do now ???
MS
|
|
|
|
|
Manfred Staiger wrote:
Since some days the debug build of my application crashes when calling the close() and requery()
members of CDaoRecordset and when deleting all recorsets of a table in a loop, the call of delete for the last recordset crashes. Stepping into the MFC code shows that it always occurs at the same place in some code for the DFX mechanism. Since it's the same problem on all my three machines and it appeared "over night", I don't think that it is a bug in MFC. The only changes on all three machines are several service packs/security patches applied from our pc-support guys, so I think the problem is within the MS JetEngine which perhaps was affected by applied patches.
So what would you do now ???
1: All Database operations should be enclosed in try catch statements. There are a number of reasons why a data connection could fail and cause your app to crash. For starters make sure its still open before attempting to close it.
2: Why loop through an entire table to delete all of the records? A Delete query is much faster.
3: What versions of jet where you using? What versions are you using now?
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
sfdougl wrote:
1: All Database operations should be enclosed in try catch statements. There are a number of reasons why a data connection could fail and cause your app to crash. For starters make sure its still open before attempting to close it.
That's right, but doesn't solve my problem.
sfdougl wrote:
2: Why loop through an entire table to delete all of the records? A Delete query is much faster.
Of course I don't loop the entire table to delete the recordsets. I only wanted to describe that the Delete() call crashes at the last recordset when you do so.
sfdougl wrote:
3: What versions of jet where you using? What versions are you using now?
Unfortunately I don't remember if it has changed. I'm now looking for a PC with an older jet version as the one I have on my machine.
MS
|
|
|
|
|
1: Okay, so what specific error are you receiving?
2: Are you making sure that you have not gone past EOF? Or attempting to delete a record that does not exist?
Source Code and Errors received would greatly expedite the process.
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
sfdougl wrote:
1: Okay, so what specific error are you receiving?
There is no exception thrown. A dialog comes up saying "User breakpoint called from code at 0x778813b1". The output window of the editor shows the following messages:
HEAP[TestApp_g.exe]: Heap block at 038C8940 modified at 038C8998 past requested size of 50
sfdougl wrote:
2: Are you making sure that you have not gone past EOF? Or attempting to delete a record that does not exist?
Yes, absolutely. Everything worked fine for more than 2 years and when I make a release build it also works fine.
I made a small example which crashes as described, and works fine as release build.
//CTestClass is derived from CDaoRecordset
//m_nDefaultType member is set to dbOpenDynaset in the constructor
//m_pDatabase member is set to an open database (which contains the table "TestTable")
void CTestClass::DeleteWithLoop()<br />
{<br />
int counter=0;<br />
this->Open(AFX_DAO_USE_DEFAULT_TYPE, "TestTable", 0);<br />
if(!this->IsEOF())<br />
{<br />
while(!this->IsEOF())<br />
{<br />
counter++;<br />
this->Delete();
this->MoveNext();<br />
} <br />
}<br />
this->Close();<br />
}
In the meantime I'm quite shure that it's a bug in the jet engine.
MS
|
|
|
|
|
Sorry it took so long for me to get back to you. I'm on an odd schedule.
1: Good question, I don’t have a clue here.
2: The problem most probably isn't the delete statement but the MoveNext() if you delete the last record and attempted to move to a record that doesn’t exist an error occurs. I have had the same problem. Perhaps, the newer DAO version is stricter about such operations.
When you get a chance can you find out what version of DAO your using? Have any workstations that where not updated?
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
Hi all,
I search the size of the childframe border from a mfc view.
I've saved the size and the coordinates to the registry. I use this size to split the view in four equal section.
But doesn't work, because I've not subtract the frame border.
Can anyone tell me the right border sizes from a childframe.
Jens
|
|
|
|
|
Call GetSystemMetrics() (with the appropriate parameter for the border that you are interested in) on the childframe in question.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
You should be using GetClientRect() to get the area to split your view up into.
If you vote me down, my score will only get lower
|
|
|
|
|
I have two PCs, and I want to setup direct connection via serial port.
I used crossed wire to connect two PCs.
I setup HyperTerminal on two PCs with the same configuation (use COM1 port).
But I cannot send data between the HyperTerminals.
Can any one suggest me ?
Thank you.
|
|
|
|
|
Not really a programming question, however!
Make sure that the cable that you are using is a fully populated NULL modem cable. You ought to be able to communicate given both Hyperterminals are set to the same baud rate etc..
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Consider several classes like this:
class Class
{
public:
Class& operator&=(const Class& c)
{ return *this; }
}; Now consider this template:
template<class A, class B>
A operator&(const A& a, const B& b)
{ return A(a)&=b; }
for any Class-like, now we have & available.
Now, consider a fragment like this
{
....
int i, flag;
....
if(i & flag)
... some action
... other actions
}
Althought not intentional (I didn't wrote that template for that), the compiler use the templetized & operator.
It should not be a problem, but ... for some reasons i becomes NULL because of the templatized operator& execution even if passed as const& (suppose i and flags have no bits in common).
Am I wrong in something or ... it's one of the C7.0 misteries ?
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
emilio_grv wrote:
return A(a)&=b;
Did you mean this?
return A(a & b);
You are modifying a by using &=
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote:
Did you mean this?
return A(a & b);
No, I meant "create a copy of "a" (through A(a)) and call the &= operator on that copy, that modifies the copy retuning a reference to the copy itself, that is copyed as a return value.
It works perfectly when A is a class having an &= operator defined, but if used with a primitive type, it seems it doesn't generate the copies, modifying the passed "value", even if it is a const&
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
emilio_grv wrote:
My bug or C++ bug
Neither: I think it is a compiler optimization/inlining bug.
There is a recurring pattern that is used in most books on the subject and what you are seeing might be why.
I would try the following:
template<class A, class B>
A operator&(const A& a, const B& b)
{ A tmp(a); return( tmp&=b ); }
OR
template<class A, class B>
A operator&(const A& a, const B& b)
{ A tmp(a); tmp&=b; return tmp; }
Hopefully one or both of these will solve the problem, since they provide more than enough information for the compiler to get it right.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I got your point: By splitting the compound instruction you try (and -in fact - it works) to force the compiler to don't optimize.
But I'm still surprised 'bout the following:
- The compilet was told to "disable optimizations", but was still "optimizing"
- the optimization side effects were out of the optimization scope, treating in fact, a constant as a variable.
I didn't test if(2 & flag) : whould it turn number 2 into 0 and add 0 to every subsecuent x+2? Terrificant!
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Well the compiler will still do some optimising. The real problem probably lays in how it is inlining the code. I do not have the 7.0 compiler, but it would be interesting to see if it would choke on (2 & flag) with your code. I suspect that it would see that and produce the correct inline code instead of what ever it was producing. The only real way to see what it is doing is to look at the asymbly code, before and after modifying the code.
No I do not believe it would turn 2 to 0, every place that 2 is in your code is unique to that piece of code, so subsequent statements where 2 is applied is unique. 2 is a true constant where the variable i was a temporay constant with a specific address location.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi
I use the CreateEnhMetaFile to create an enhanced metafile. The third parameter is the rectangle which give me the sizeo of the metafile. Is it possible to alter that side after
the creation? This will allow me to scale better my metafile. Ideally I am locking for something like:
CMetaFileDC * pDCMetaFile = .....;
pDCMetaFile->CreateEnhanced(p_dc, filename.data(), &rect, NULL);
rect = new sizes;
pcDCMetaFile->alterSize(rect);
Thanks a lot
Always try to keep things as simple as possible
|
|
|
|
|
Not sure what you're trying to accomplish - you can draw a metafile into any size area you desired. The size passed to CreateEnhanced() is more for future reference than anything else, it isn't enforced.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
In the build stage I get these errors
HPMumsCtl.obj : error LNK2019: unresolved external symbol "public: __thiscall CParser::CParser(void)" (??0CParser@@QAE@XZ) referenced in function "public: __thiscall CHPMumsCtrl::CHPMumsCtrl(void)" (??0CHPMumsCtrl@@QAE@XZ)
HPMumsCtl.obj : error LNK2019: unresolved external symbol "public: double __thiscall CvsAwk::GetVal(void)" (?GetVal@CvsAwk@@QAENXZ) referenced in function "public: void __thiscall CHPMumsCtrl::ResolveVariables(char *)" (?ResolveVariables@CHPMumsCtrl@@QAEXPAD@Z)
HPMumsCtl.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvsAwk::SetL(char const *)" (?SetL@CvsAwk@@QAEXPBD@Z) referenced in function "public: void __thiscall CHPMumsCtrl::ResolveVariables(char *)" (?ResolveVariables@CHPMumsCtrl@@QAEXPAD@Z)
.\Debug/NewMumsEngine.exe : fatal error LNK1120: 3 unresolved externals
Although it doesn't show anything while compiling.
I have an instance of Cparser type Compute(Cparse Compute;) in my main class(CHPMumsCtrl).
This Cparser class has a
CvsAwk m_CtrlAwk; declared in its class definition,and also has a #include "vsawk.h"
I am not sure of what this CvsAwk is or does(have a faint idea).Can you please tell me what to do to remove these build errors.As all of them have the same problem,I guess they all have one common error.
Thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
you're missing vsawk.cpp in list of source files in your project,
or you're missing some library where cvsawk is implemented (or this library is not specified in list of libraries to be included while linking)
rrrado
|
|
|
|
|
I want do to a programm which registers all the scrolls of vertical scroll bar from IE.The problem is I cannot catch any scroll message.Thanks.
|
|
|
|
|
Did you try the IHTMLWindow2 -> put_onscroll event handler ?
rrrado
|
|
|
|
|
How can i learn using PerformanceGraph ...it is very important... if you know any document or article!!
|
|
|
|
|
Hi,Everyone:
I got following questions:
1> i want to transform a wave's format to standard format i needed(such as 8000HZ,16 bit,mono,signed) we can use software Goldwave’s “Effects->Resample”. But are there any classes or functions in VC?
2> we aslo want to transform the standard wave (we get from the first step) to A-Law PCM Signals.
How can I realize that in VC? Can any of you give me some threads or links?
Thank you very much!
- - - - - - - - - - - - - - - - - - - - - - - -
Many nights we've prayed with no proof anyone could hear, we were moving moutains long before we knew we could!
Yet now i'm standing here, although we know there's much to fear, hope seemed like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill!
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|