|
So create the global recordset after you have a database, and recreate it if the database changes.
You can do that with a global pointer instead of a global object.
It still doesn't make sense to do what you're trying to do in the context of the MFC database classes design.
Since recordsets are dependent on a database, it doesn't make sense to create them in reverse order.
That's why there's not a method in the framework to do it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Can anyone please tell me how to catch all possible exceptions of my C++ Console program (My program doesn't use MFC).
Regards,
Mushq
|
|
|
|
|
With a big try block.
void main()
{
try
{
}
catch(...)
{
}
}
BTW I don't know if it is a good idea.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi,
the big try-catch is great as a fall-back, to exit gracefully with a log;
but it is no substitute for the regular try-catch blocks you should implement at
critical points in the code.
Also it only catches exceptions in the main thread. So there is a lot more to it to get
it right.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: which also depends on the .NET version
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
the sentence, while IMO correct if you use .NET, was deleted the minute I posted my reply,
so the reply does not show a "modified..." message. I am surprised you were able to see it anyway.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: I am surprised you were able to see it anyway.
It's a multithread issue depending on .NET version I suppose...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I have always been assuming a post only became visible after a 2 to 3 minutes, giving
the author the opportunity to correct it without creating replies like these...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Nah It's fast. What are the odds a goofball like me would catch it the instant you posted
and give you a hard time about it?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hehe I just happened to refresh as you posted the first time
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Luc Pattyn wrote: the big try-catch is great as a fall-back, to exit gracefully with a log;
but it is no substitute for the regular try-catch blocks you should implement at
critical points in the code.
I Know. My "I don't know if it is a good idea" was about that.
Luc Pattyn wrote: Also it only catches exceptions in the main thread. So there is a lot more to it to get
it right.
he may repeat the pattern in all program threads.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: he may repeat the pattern in all program threads.
and in all callback functions/methods (e.g. timer ticked, serialport datareceived),
requiring the implementation of an exception tracing mechanism, so the info does not
get lost.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I make a guess: he is not developing a OS from scratch...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: I make a guess: ...
I'm not a guessing guy, and the OP explicitly asked how to catch all possible exceptions,
hence...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: I'm not a guessing guy
Well, I will not keep going at your limitations...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
Exceptions depednds to your program,what's your code?
|
|
|
|
|
Every time I used TextOut (e.g. TextOut(dc,20,20,S,strlen(S)); ) with Borland C++ 4.52 under Windows 95 or Windows 98, the position of the text (in the second & third args) was relative to the window that the calling application was running in. But with Visual C++ under Windows Vista the text is positioned (here, at (20,20)) relative to the whole screen. This is a nuisance. What is happening? How can I position the text relative to my application's window?
modified on Saturday, April 12, 2008 9:01 AM
|
|
|
|
|
I dont know why the phenomenon happens, anyway ClientToScreen [^] function maybe useful.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
TextOut() in the context you show is a Windows API - it shouldn't vary between compilers.
It could vary between Windows versions, but that would break a lot of apps.
The problem is your DC. The device context determines where the text goes, based on how the DC
was acquired, its mapping mode, its text alignment settings, etc.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I made the device context using ordinary familiar GetDC(hwnd) .
|
|
|
|
|
Then hwnd must have been NULL.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi!
I know this may looks a little funny! But when I use CDialog::EndDialog to terminate my dialog based app, the main window (dialog) disapears well, but when looking at Task Manager, I found it already running!
Can U help me PLS?
|
|
|
|
|
Hi,
If you have other threads running, the app will wait for them to terminate, unless they
are set to be background threads.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks 4 Ur reply!
I've not made any thread myself;
Is it possible for MFC classes to create threads by themselves? (Specially I used CRecordset frequently in my app!)
Thanks 4 Ur attention!
|
|
|
|