|
Hey all,
I have a strange problem with an exception being thrown and not caught properly. The exception is of the CDBException type and the code looks like the snippet given below. If I give an erroneous sql statement, an exception is thrown and caught, but when I leave the END_CATCH (or END_CATCH_ALL for that matter), the program crashes. This only occurs in release mode - debug mode is trapping and continuing fine. Sounds like I'm running rampage in my mem region, but I'm fairly sure I'm not...Any help on this will be mighty appriciated.
CRecordset* pRecordset = NULL;
TRY
{
BOOL bIsRecordPresent = FALSE;
//make the recordset
pRecordset = new CRecordset( &m_Database );
//open it
if (pRecordset->Open(CRecordset::snapshot, szSQLIsPresent, CRecordset::readOnly))
{
...
}
}
CATCH(CDBException, eDB)
{
char bufErr[512];
eDB->GetErrorMessage(bufErr, 512, NULL);
eDB->Delete();
//error reporting
}
CATCH(CMemoryException , e)
{
char bufErr[512];
e->GetErrorMessage(bufErr, 512, NULL);
e->Delete();
//error reporting
}
END_CATCH
Best regards
/Boris
|
|
|
|
|
Found it - The exception clean up of CDBException 'eDB->Delete();' throws a new exception.
Have no idea why
/Boris
|
|
|
|
|
is there any api that tell the name of currently
login user ?
is there any api that tell the status of the os?
i mean to say that wheather the system is in logof aur login state?
r00d0034@yahoo.com
|
|
|
|
|
GetUserName will give you the name of the user that is currently logged in
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
how to start a process ? and get its id ?
how to process active window hwnd ?
r00d0034@yahoo.com
|
|
|
|
|
What on earth do you mean by
imran_rafique wrote:
how to process active window hwnd ?
How do you WANT to process it ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I have a property sheet (CPropertySheet ) with 2 property pages (CPropertyPage ).
So, the problem is that when I click on the second page (change to the second page) this page will not get the focus! I have to click on any control on this page (or with the tab key) to get the focus!
How can I fix that?
(I am working with Embedded Visual C++, PocketPC / PocketPC 2002, MFC)
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Is your Layout > Tab order set correctly so that the first item in the tab order is a control and not static text or something like that?
|
|
|
|
|
Yes! There is only one tree control (CTreeCtrl ) with 3 buttons on the property page and the tree control is the first element in the tab order!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I can assume CRT functions would probably out perform my own for loop functions...?
The idea is this:
I have a buffer[0xFFFF] I wish to iterate the buffer looking for sequences of characters (carriage returns).
Currently I have something like:
for(int i=0; i<MAX_BUFF_SIZE && m_nLines < iLine; i++)
{ if(buffer[i] == 13) m_nLines++; }
It occurred to me that this can also be accomplished using CRT functions, which I thought are probably tweaked as tweaked can get...so I should probably use that implementation instead of the above...???
If you know if the CRT would out perform lemme know and if you wanna profile for me or check out the assembly dump and compare instructions, by all means please do so...
Save me alot of time...or if your just damn sure that CRT would be faster...lemme know...
Thanx a million
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I doubt strchr will help much. In fact, it might hurt if you make the following optimization to your routine.
if (m_nLines < iLine)
{
for (int i = 0; i < MAX_BUFF_SIZE; i++)
{
if (buffer [i] == 13)
{
m_nLines++;
if (m_nLines >= iLine)
break;
}
}
}
Now, you might get some improvement with using memchr.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Look under \Program Files\Microsoft Visual Studio\VC98\CRT\SRC\Intel\ for the file STRCHR.ASM
It's fast as hell.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Where will you be using this loop? If it gets called only once in a while, I would not worry about tweaking its performance because it is relatively simple loop that counts the number or return carraiges in a buffer.
However if you are going to be calling this function every time that a character is pressed that is another issue.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
(for previous message, threading error)
*SLAP* (myself)
When I said it wouldn't help much, I had just seen the C version of the routine. Silly silly me.
But I still think memchr would be a better fit for him.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Paul Watt wrote:
However if you are going to be calling this function every time that a character is pressed that is another issue.
Yes this correct...I chose this over a line vector(terminology???) so it gets called each time a key is pressed...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How is memchr() better than strchr() ? Are there fewer instructions...? Faster instructions....? Whats the deal...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
strchr assumes NULL terminated string. Thus an extra test for a NULL. memchr doesn't have that.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Awesome...thanks
I suppose I could have up the *.asm files myself and determined which was faster, but I guess I just wasn't thinking.
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
This is what I was thinking, I just needed to hear it form somebody other than myself...
Thanx
p.s - No i don't hear voices
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi,
I'm very new to VC++ and I hope someone can help me out!
I'm trying to write a program to take audio samples from the sound card but I keep getting an "unresolved external symbol" error and I have no idea why! I have the code to set up the wave format but once I try and query the soundcard it complains. Am I doing something wrong?
Record Sound error LNK2019: unresolved external symbol__imp__waveInOpen@24 referenced in function "void__cdecl RecordWaveFile(void)" (?RecordWaveFile@@YAXXZ)
void RecordWaveFile()
{
HWAVEIN WaveHandle;
WAVEFORMATEX WaveFormat;
WaveFormat.wFormatTag = WAVE_FORMAT_PCM;
WaveFormat.nChannels = 1;
WaveFormat.nSamplesPerSec = 22050;
WaveFormat.wBitsPerSample = 8;
WaveFormat.nAvgBytesPerSec = 22050;
WaveFormat.nBlockAlign = 1;
WaveFormat.cbSize = 0;
int Res = waveInOpen(&WaveHandle, WAVE_MAPPER, &WaveFormat, 0, 0, WAVE_FORMAT_QUERY);
if (Res == WAVERR_BADFORMAT) return;
}
Thanks in advance,
Paddy.
|
|
|
|
|
Add to your project settings, under 'Link->Object/Library modules' tab, Winmm.lib.
That's bout-it.
--BlackSmith--
/*The roof is on fire, we don't need no water, let the MF burn*/. BHG.
|
|
|
|
|
Thanks,
You wouldn't believe how long I've been trying to fix that for!!!
|
|
|
|
|
Alternatively, you can also put #pragma comment(linker, "winmm.lib") to the top of the source file. That's the way I do it whenever I need to link with a new lib file apart from the ones already set in the linker options
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
When i try to open a video decompressor used for drawing, it causes a user breakpoint. If i just try to open it for decompressing, it works fine! Here's how i do it:
hVideo = ICLocate(ICTYPE_VIDEO, VideoHeader.fccHandler, &VideoInfo.bmiHeader, NULL, ICMODE_DRAW);
If i do exactly the same except chane ICMODE_DRAW to ICMODE_DECOMPRESS everything works fine. What am i doing wrong?
Tanks all!
-Rune Svendsen
|
|
|
|