Click here to Skip to main content
15,918,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMaking an Object global Pin
viperlogic14-Mar-06 10:18
viperlogic14-Mar-06 10:18 
AnswerRe: Making an Object global Pin
BadKarma14-Mar-06 10:29
BadKarma14-Mar-06 10:29 
GeneralRe: Making an Object global Pin
viperlogic14-Mar-06 11:27
viperlogic14-Mar-06 11:27 
AnswerRe: Making an Object global Pin
Stephen Hewitt14-Mar-06 17:18
Stephen Hewitt14-Mar-06 17:18 
AnswerRe: Making an Object global Pin
ThatsAlok14-Mar-06 18:20
ThatsAlok14-Mar-06 18:20 
AnswerRe: Making an Object global Pin
ThatsAlok14-Mar-06 18:22
ThatsAlok14-Mar-06 18:22 
GeneralRe: Making an Object global Pin
viperlogic14-Mar-06 23:23
viperlogic14-Mar-06 23:23 
GeneralRe: Making an Object global Pin
Stephen Hewitt15-Mar-06 0:06
Stephen Hewitt15-Mar-06 0:06 
The "m_" wart is normally used to denote a class member variable and not a local variable as you’re using it. Follow these steps:
1. Remove the CSQLConnection m_conn; from the function.
2. Add it to your class definition. i.e.
class CYourDialog : public CDialog
{
public:
     // Blah, blah, blah....
 
protected:
     // Blah, blah, blah....
 
private:
     CSQLConnection m_conn;
     // Blah, blah, blah....
};


Notice I added the member variable as private, this is good form - As a rule of thumb always apply the most restrictive access permissions possible. You can always relax them later if need be.

Now you can access the variable "m_conn" anywhere in that class. It's not a global however as it can't be accessed from other classes or global functions.

Only use the "m_" wart on member variables (variables declared in the class definition) or else you'll confuse people.


Steve
GeneralRe: Making an Object global Pin
viperlogic15-Mar-06 2:22
viperlogic15-Mar-06 2:22 
Questionhow to detect hyperlink from word file Pin
mk_le14-Mar-06 9:48
mk_le14-Mar-06 9:48 
QuestionExample on creating an item identifier list Pin
Chris Meech14-Mar-06 9:33
Chris Meech14-Mar-06 9:33 
AnswerRe: Example on creating an item identifier list Pin
Michael Dunn14-Mar-06 10:28
sitebuilderMichael Dunn14-Mar-06 10:28 
GeneralRe: Example on creating an item identifier list Pin
Chris Meech15-Mar-06 2:37
Chris Meech15-Mar-06 2:37 
AnswerRe: Example on creating an item identifier list Pin
Graham Bradshaw14-Mar-06 12:05
Graham Bradshaw14-Mar-06 12:05 
GeneralRe: Example on creating an item identifier list Pin
Chris Meech15-Mar-06 2:40
Chris Meech15-Mar-06 2:40 
QuestionProblem comparing 'double' values Pin
Wheatbread14-Mar-06 9:23
Wheatbread14-Mar-06 9:23 
AnswerRe: Problem comparing 'double' values Pin
Maximilien14-Mar-06 10:06
Maximilien14-Mar-06 10:06 
GeneralRe: Problem comparing 'double' values Pin
Wheatbread14-Mar-06 10:52
Wheatbread14-Mar-06 10:52 
GeneralRe: Problem comparing 'double' values Pin
Maximilien14-Mar-06 12:49
Maximilien14-Mar-06 12:49 
GeneralRe: Problem comparing 'double' values Pin
DRHuff14-Mar-06 17:33
DRHuff14-Mar-06 17:33 
Questionextending desktop window Pin
Manu_8114-Mar-06 7:09
Manu_8114-Mar-06 7:09 
Questionvery slow to open a file in huge directory Pin
mk_le14-Mar-06 6:58
mk_le14-Mar-06 6:58 
AnswerRe: very slow to open a file in huge directory Pin
Maximilien14-Mar-06 7:03
Maximilien14-Mar-06 7:03 
GeneralRe: very slow to open a file in huge directory Pin
mk_le14-Mar-06 7:05
mk_le14-Mar-06 7:05 
GeneralRe: very slow to open a file in huge directory Pin
Maximilien14-Mar-06 7:12
Maximilien14-Mar-06 7:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.