|
If I'm using the code below:
Connection CDataManDlg::CreateDBConnection()
{
Connection con (use_exceptions);
try {
con.connect ("fatapes", m_strHost, "root");
}
catch (BadQuery e) {
TRACE (_T ("Error in CreateDBConnect = %s"), e.error.c_str ());
MessageBox (_T ("Unable to create database connection"), _T ("Connection Error"));
}
return con;
} is the reason that I can't use the 'Connection' object after the return becuase it's destroyed? Doesn't the function return a copy of the object before it gets destoryed?
Thanks in advance.
- monrobot13
|
|
|
|
|
Modify your function to return a Connection* and remember to delete the pointer after usage, perhaps in a different member function named CloseDBConnection.
Or add a Connection member to your CDataManDlg class.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks for the help, it clarifies things for me.
- monrobot13
|
|
|
|
|
I have Windows XP with VC++ .NET. My program was using visual styles beautifully, until yesterday! Now my app looks like it does in Windows 98 I have absolutely no idea why it's not working, except that I was doing a little re-arranging in my resource.h. The xml file is still there, though. Could you walk me through the steps in enabling visual styles?
Thanks!
|
|
|
|
|
Do you still have the manifest file included in resources? If so, what's the ID of this resource?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
If you are including the manifest as a resource, it must have resource ID 1.
"Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle
|
|
|
|
|
AFAIR, there's an
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
somewhere in SDK headers.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Thanks, that's probably my problem!
|
|
|
|
|
We have a big map here at work which is in a vector format, and we want to chop it up into subsections. The issue is that if a line intersects two crosssections, we'd like it to be drawn properly in both without any messing about.
Does anyone know of any tools/code that can easily do that ?
Thanks
Christian
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
|
|
|
|
|
Is it the case that you simply need to cut larger lines
into smaller lines that cross no boundaries so that you
can easily assign lines to subsections?
Because of rendering considerations, a large line may
not be equivalent to a set of smaller lines. Does this
come into consideration?
|
|
|
|
|
I need to create accuracte subsections, including the subsections of a line that may not be entirely in the square I am creating.
Christian
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
|
|
|
|
|
Can anyone recomend a good free WinHelp authoring tool?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
|
Hello there,
How can i get IDispatch from _Recordset ??
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I have a ownerdraw listbox and need to use multiple fonts (normal, bold, underlined). At the moment I create the fonts each time in my DrawItem handler. Is this really necesarry? Or can I precreate them once and reuse the font objects?
My experience with windows controls is poor, so thanks for feedback.
|
|
|
|
|
You can have the fonts precreated as members of your class and use them in DrawItem as necessary. Just remember to deselect them from the drawing DC when exiting DrawItem .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Just remember to deselect them from the drawing DC when exiting DrawItem.
I believe you can leave them selected (if fonts are precreated). The lifetime of DC used in WM_DRAWITEM is shorter than lifespan of the window.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Hi Tomasz! We seem to be disagreeing all the time tonight MSDN docs say (here[^]):
The application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct before this member function terminates.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
We seem to be disagreeing all the time tonight
That's my favorite aspect of CP forums
Anyway, I was thinking along deselect-or-else-your-font-will-not-be-destroyed line. The MSDN guideline applies to locally created fonts as well.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Well, I happily admit that the selection/deselection stuff is one of those things I've been wanting to understand in detail since long ago but didn't have time to learn about. Usually I'm content with the most conservative approach of deselecting everything.
*** Si fractum non sit, noli id reficere. ***
I'd say it is better "Si fractum non est, noli id reficere".
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
I'd say it is better "Si fractum non est, noli id reficere".
Quick google reveals that it's actually 'non sit'. Maybe it's just kind of Latin urban legend
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Joaquín M López Muñoz wrote:
. Just remember to deselect them from the drawing DC when exiting DrawItem.
Well, this is something I don't understand yet... why do I need to deselect them? Could you explain me a little more background or pointing me to a tutorial?
Once I forgot to deselect my bold font in DrawItem(), the listbox keept drawing in bold. I didn't got any error/problems.
Thanks!
|
|
|
|
|
Well, I don't undertand all the issues behind this policy, but apparently the DC could be used somewhere else and display strange things because of the garbage you left out. Also, resource leaks can occur, I think.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
okay i read some msdn and make it work (hopefully hehe). thanks for your help!
|
|
|
|
|
Anonymous wrote:
Or can I precreate them once and reuse the font objects?
You can do that.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|