[shell-coding] Re: try() catch()

Should be already.

As far as I know there is no problem except if you left the catch scope
before its over. --> exception

 

Dominik

 

-----Original Message-----
From: shell-coding-bounce@xxxxxxxxxxxxx
[mailto:shell-coding-bounce@xxxxxxxxxxxxx] On Behalf Of
Bgvinyard@xxxxxxx
Sent: Dienstag, 21. Januar 2003 03:20
To: shell-coding@xxxxxxxxxxxxx
Subject: [shell-coding] try() catch()

 

Ok... im not too sure on this so thought i would get some expert help...


given this:

class Localization
{
public: 
        Localization();
        ~Localization();
        
        void LoadLanguage(LANGID wLanguageID);
        int LoadString(UINT uID, LPTSTR ptzBuffer, size_t cchMax);
        int MessageBox(HWND hWnd, UINT uText, UINT uCaption, UINT
uType);
        int MessageBox(HWND hWnd, LPCTSTR ptzText, UINT uCaption, UINT
uType);
        
private:
        HINSTANCE m_hRes;
        LANGID m_wLanguageID;
};

I want to do something like this:

try
{
        ...
}
catch(...)
{
        TCHAR tzError[MAX_LINE_LENGTH];
        Localization lError;
        
        if (lError.LoadString(IDS_MODULEINITEXCEPTION_ERROR, tzError,
MAX_LINE_LENGTH))
        {
                TCHAR tzErrorEx[MAX_LINE_LENGTH];
                StringCchPrintf(tzErrorEx, MAX_LINE_LENGTH, tzError,
iter->first.c_str());
                lError.MessageBox(NULL, tzErrorEx,
IDS_LITESTEP_TITLE_ERROR);
        }                                                       
}

I'm not sure this would affect object unwinding because its withing the
catch block, unless 
the code within the catch block throws an exception... any comments?
suggestions?

Thanks
Message

Other related posts: