Click here to Skip to main content
15,889,909 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: simple error with printing Pin
David Crow11-May-07 3:40
David Crow11-May-07 3:40 
QuestionHow can I stop the program that run by DLL. Pin
Max++11-May-07 2:31
Max++11-May-07 2:31 
AnswerRe: How can I stop the program that run by DLL. Pin
Christian Graus11-May-07 2:45
protectorChristian Graus11-May-07 2:45 
GeneralRe: How can I stop the program that run by DLL. Pin
Max++11-May-07 3:16
Max++11-May-07 3:16 
GeneralRe: How can I stop the program that run by DLL. Pin
prasad_som11-May-07 4:02
prasad_som11-May-07 4:02 
QuestionException handling in Constructor Pin
ragavan11-May-07 1:55
ragavan11-May-07 1:55 
AnswerRe: Exception handling in Constructor Pin
CPallini11-May-07 2:02
mveCPallini11-May-07 2:02 
AnswerRe: Exception handling in Constructor Pin
shiraztk11-May-07 2:35
shiraztk11-May-07 2:35 
Hi
Make the constructors private, then create a static member function called InitYourObject().

CYourClass * CYourClass::InitYourObject()<br />
{<br />
    try<br />
    {<br />
       CYourClass *object = new CYourClass;<br />
       return object;<br />
    }<br />
    catch(...)<br />
    {<br />
        //handle the error <br />
        return NULL; // or throw exception<br />
     }<br />
}


To create an object call

CYourClass *myObject = CYourClass::InitObject();

Hope it helps

Regards

The Best Religion is Science.
Once you understand it, you will know God.

AnswerRe: Exception handling in Constructor Pin
#realJSOP11-May-07 2:47
mve#realJSOP11-May-07 2:47 
AnswerRe: Exception handling in Constructor Pin
Nemanja Trifunovic11-May-07 4:33
Nemanja Trifunovic11-May-07 4:33 
QuestionUser name/Password authentication Pin
TariqZ11-May-07 1:46
TariqZ11-May-07 1:46 
AnswerRe: User name/Password authentication Pin
Christian Graus11-May-07 1:53
protectorChristian Graus11-May-07 1:53 
GeneralRe: User name/Password authentication Pin
Nelek13-May-07 20:16
protectorNelek13-May-07 20:16 
AnswerRe: User name/Password authentication Pin
CPallini11-May-07 1:59
mveCPallini11-May-07 1:59 
Questionplz send the program Pin
gnanabhaskar11-May-07 1:43
gnanabhaskar11-May-07 1:43 
AnswerRe: plz send the program Pin
Dominik Reichl11-May-07 1:50
Dominik Reichl11-May-07 1:50 
AnswerRe: plz send the program Pin
Christian Graus11-May-07 1:51
protectorChristian Graus11-May-07 1:51 
AnswerRe: plz send the program Pin
ThatsAlok17-May-07 5:00
ThatsAlok17-May-07 5:00 
QuestionPrivate assignment operator Pin
ragavan11-May-07 1:12
ragavan11-May-07 1:12 
AnswerRe: Private assignment operator Pin
James R. Twine11-May-07 1:41
James R. Twine11-May-07 1:41 
GeneralRe: Private assignment operator Pin
ragavan11-May-07 1:57
ragavan11-May-07 1:57 
GeneralRe: Private assignment operator Pin
James R. Twine11-May-07 2:04
James R. Twine11-May-07 2:04 
GeneralRe: Private assignment operator Pin
Arman S.11-May-07 2:36
Arman S.11-May-07 2:36 
GeneralRe: Private assignment operator Pin
David Crow11-May-07 2:46
David Crow11-May-07 2:46 
QuestionHow to convert std::wstring to const WCHAR*? Pin
sandeepkavade11-May-07 0:45
sandeepkavade11-May-07 0:45 

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.