How to throw an exception

Hi all,

I have an function like this

A & foo(int a, int b)
{...
   if (a<b)
  { //throw an exception
  }
}

where A is a class.

Inside this function , I need to check if a<b, if yes then throw an
exception, how should I do , then? I didn't do this before, any help
will be appreciated!


Best wishes,
Green

0
11/29/2006 9:39:49 AM
vc.mfc 33608 articles. 0 followers. Follow

17 Replies
711 Views

Similar Articles

[PageSpeed] 54

On 29 Nov 2006 01:39:49 -0800, "flamesky" <myflamesky@hotmail.com>
wrote:

>Hi all,
>
>I have an function like this
>
>A & foo(int a, int b)
>{...
>   if (a<b)
>  { //throw an exception
>  }
>}
>
>where A is a class.
>
>Inside this function , I need to check if a<b, if yes then throw an
>exception, how should I do , then? 

Your question seems to me more a "pure C++" question than an MFC
question, so maybe the .vc.language newsgroup would be the right place
to ask...

However, to throw an exception, the C++ keyword to use is "throw".

if ( a < b )
    throw std::exception( "a < b happened" );

Here I used the standard exceptin class (std::exception), but you can
define your own exception class, deriving from std::exception or from
std::<other standard exception classes> or from your own root
exception class.

Hope this helps.

Bye
MrAsm
0
invalid460 (432)
11/29/2006 10:48:32 AM
Thanks very much!

MrAsm wrote:
> On 29 Nov 2006 01:39:49 -0800, "flamesky" <myflamesky@hotmail.com>
> wrote:
>
> >Hi all,
> >
> >I have an function like this
> >
> >A & foo(int a, int b)
> >{...
> >   if (a<b)
> >  { //throw an exception
> >  }
> >}
> >
> >where A is a class.
> >
> >Inside this function , I need to check if a<b, if yes then throw an
> >exception, how should I do , then?
>
> Your question seems to me more a "pure C++" question than an MFC
> question, so maybe the .vc.language newsgroup would be the right place
> to ask...
>
> However, to throw an exception, the C++ keyword to use is "throw".
>
> if ( a < b )
>     throw std::exception( "a < b happened" );
>
> Here I used the standard exceptin class (std::exception), but you can
> define your own exception class, deriving from std::exception or from
> std::<other standard exception classes> or from your own root
> exception class.
> 
> Hope this helps.
> 
> Bye
> MrAsm

0
11/29/2006 1:57:45 PM
On 29 Nov 2006 05:57:45 -0800, "flamesky" <myflamesky@hotmail.com>
wrote:

>Thanks very much!

You're welcome!

MrAsm

0
invalid460 (432)
11/29/2006 2:06:32 PM
In MFC, you would do

class CALssBException : public CException {};

then you would

	throw new CALssBException;

in the handler

	catch(CALssBException * e)
	    {
                     ... deal with it
	     e->Delete();
                     ...do whatever you want
                    }

				joe

On 29 Nov 2006 01:39:49 -0800, "flamesky" <myflamesky@hotmail.com> wrote:

>Hi all,
>
>I have an function like this
>
>A & foo(int a, int b)
>{...
>   if (a<b)
>  { //throw an exception
>  }
>}
>
>where A is a class.
>
>Inside this function , I need to check if a<b, if yes then throw an
>exception, how should I do , then? I didn't do this before, any help
>will be appreciated!
>
>
>Best wishes,
>Green
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
11/29/2006 3:30:30 PM
MrAsm is correct (although I tend to be less picky about what types of 
questions people ask here :o)).  This tutorial might be interesting to you:

http://www.go4expert.com/forums/showthread.php?t=1324

Tom

"flamesky" <myflamesky@hotmail.com> wrote in message 
news:1164793189.259460.201860@j72g2000cwa.googlegroups.com...
> Hi all,
>
> I have an function like this
>
> A & foo(int a, int b)
> {...
>   if (a<b)
>  { //throw an exception
>  }
> }
>
> where A is a class.
>
> Inside this function , I need to check if a<b, if yes then throw an
> exception, how should I do , then? I didn't do this before, any help
> will be appreciated!
>
>
> Best wishes,
> Green
> 


0
tserface (3860)
11/29/2006 3:36:20 PM
On Wed, 29 Nov 2006 07:36:20 -0800, "Tom Serface" <tserface@msn.com>
wrote:

>MrAsm is correct (although I tend to be less picky about what types of 
>questions people ask here :o)).  

:-)

Tom: ...maybe you are right.
Please forgive me for my "pickyness" :)

MrAsm
0
invalid460 (432)
11/29/2006 3:57:07 PM
On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
<newcomer@flounder.com> wrote:

>	throw new CALssBException;
>
>in the handler
>
>	catch(CALssBException * e)
>	    {
>                     ... deal with it
>	     e->Delete();

Would it be better to throw without operator new (and catch by
reference &), so the exception destructor is automatically called and
there is no need for e->Delete() ?

Thanks in advance,
MrAsm
0
invalid460 (432)
11/29/2006 3:59:41 PM
It's not a problem.  I couldn't resist poking a little fun...  You were very 
polite and at least you answered the question.  I've seen others say words 
to the effect of "go look somewhere else dummy" and that always makes my 
stomach churn a bit ... :o)

Tom

"MrAsm" <invalid@invalid.com> wrote in message 
news:r3brm2dj2d3co0fq3tiu51f28pt85ovjn8@4ax.com...
> On Wed, 29 Nov 2006 07:36:20 -0800, "Tom Serface" <tserface@msn.com>
> wrote:
>
>>MrAsm is correct (although I tend to be less picky about what types of
>>questions people ask here :o)).
>
> :-)
>
> Tom: ...maybe you are right.
> Please forgive me for my "pickyness" :)
>
> MrAsm 


0
tserface (3860)
11/29/2006 4:16:29 PM
On Wed, 29 Nov 2006 08:16:29 -0800, "Tom Serface" <tserface@msn.com>
wrote:

>It's not a problem.  I couldn't resist poking a little fun... 

Don't resist, don't resist. It is good to poke a bit of fun :)

Ciao
MrAsm
0
invalid460 (432)
11/29/2006 4:33:55 PM
MFC exceptions are thrown as a pointer to 'new' allocated object, and Delete 
is called by 'catch' block. That's historically.

"MrAsm" <invalid@invalid.com> wrote in message 
news:bgbrm2d57u2erk6vhn8p765thto85cnr2v@4ax.com...
> On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
> <newcomer@flounder.com> wrote:
>
>> throw new CALssBException;
>>
>>in the handler
>>
>> catch(CALssBException * e)
>>     {
>>                     ... deal with it
>>      e->Delete();
>
> Would it be better to throw without operator new (and catch by
> reference &), so the exception destructor is automatically called and
> there is no need for e->Delete() ?
>
> Thanks in advance,
> MrAsm 


0
alegr (1131)
11/29/2006 4:36:17 PM
MFC Exceptions are usually thrown by using new, and there are several handlers (such as in
varous .cpp files in the MFC sources) which catch CException *, so throwing a
non-CException* would bypass these handlers, with potentially serious consequences.  Note
that you should not be fooled by the macro CATCH(CException, e) because that macro is
defined in afx.h as

#define CATCH(class, e) catch(class * e)

with some additional error checking added (not shown here).  So to be consistent with the
internal expectations of MFC, the 'new' is required.
					joe

On Wed, 29 Nov 2006 15:59:41 GMT, MrAsm <invalid@invalid.com> wrote:

>On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
><newcomer@flounder.com> wrote:
>
>>	throw new CALssBException;
>>
>>in the handler
>>
>>	catch(CALssBException * e)
>>	    {
>>                     ... deal with it
>>	     e->Delete();
>
>Would it be better to throw without operator new (and catch by
>reference &), so the exception destructor is automatically called and
>there is no need for e->Delete() ?
>
>Thanks in advance,
>MrAsm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
11/29/2006 6:58:08 PM
Thank all guys for your kind help and suggestion !

Have a pleasant weekend,

Green

flamesky wrote:
> Hi all,
>
> I have an function like this
>
> A & foo(int a, int b)
> {...
>    if (a<b)
>   { //throw an exception
>   }
> }
>
> where A is a class.
>
> Inside this function , I need to check if a<b, if yes then throw an
> exception, how should I do , then? I didn't do this before, any help
> will be appreciated!
> 
> 
> Best wishes,
> Green

0
12/2/2006 5:26:13 AM
MrAsm skrev:
> On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
> <newcomer@flounder.com> wrote:
>
> >	throw new CALssBException;
> >
> >in the handler
> >
> >	catch(CALssBException * e)
> >	    {
> >                     ... deal with it
> >	     e->Delete();
>
> Would it be better to throw without operator new (and catch by
> reference &), so the exception destructor is automatically called and
> there is no need for e->Delete() ?

That is absolute the best way - throwing via new and catching by
pointer is more than horrible!
I do not know MFC very well and perhaps there is some reason still to
use this method, but if there is not, you'd better use accepted C++
idioms.

/Peter
(You should catch by const reference if you can)
> 
> Thanks in advance,
> MrAsm

0
12/2/2006 3:36:23 PM
See below...
On 2 Dec 2006 07:36:23 -0800, "peter koch" <peter.koch.larsen@gmail.com> wrote:

>
>MrAsm skrev:
>> On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
>> <newcomer@flounder.com> wrote:
>>
>> >	throw new CALssBException;
>> >
>> >in the handler
>> >
>> >	catch(CALssBException * e)
>> >	    {
>> >                     ... deal with it
>> >	     e->Delete();
>>
>> Would it be better to throw without operator new (and catch by
>> reference &), so the exception destructor is automatically called and
>> there is no need for e->Delete() ?
>
>That is absolute the best way - throwing via new and catching by
>pointer is more than horrible!
>I do not know MFC very well and perhaps there is some reason still to
>use this method, but if there is not, you'd better use accepted C++
>idioms.
****
Well, for those of us who do know MFC, we have to live with the idioms MFC uses.  And
those involve 'new'.  Why this is considered "good" I do not know, but if I want my
exceptions to be derived from CException and Play Well With Others, I have to use them in
the same way MFC uses them, even if it is not the ideal way.

By the way, what happens to the temporary object used if you don't use 'new'?
****
>
>/Peter
>(You should catch by const reference if you can)
>> 
>> Thanks in advance,
>> MrAsm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
12/2/2006 11:59:38 PM
Joseph M. Newcomer skrev:
> See below...
> On 2 Dec 2006 07:36:23 -0800, "peter koch" <peter.koch.larsen@gmail.com> wrote:
>
[snip
***
> Well, for those of us who do know MFC, we have to live with the idioms MFC uses.  And
> those involve 'new'.  Why this is considered "good" I do not know, but if I want my
> exceptions to be derived from CException and Play Well With Others, I have to use them in
> the same way MFC uses them, even if it is not the ideal way.
But how do you cope with non-mfc exceptions? Does using mfc prevent you
from using libraries that follow the standard?
BTW I believe a lot of the reasonig behind MFCs design is rooted in the
inadequacy of the old Microsoft compilers (jokingly referred to Visual
MFC++ by some).
>
> By the way, what happens to the temporary object used if you don't use 'new'?

I am not sure I understand. The exception is destroyed like any other
temporary would be. Is that what you mean?

/Peter

0
12/3/2006 1:29:06 PM
On 2 Dec 2006 07:36:23 -0800, "peter koch" <peter.koch.larsen@gmail.com>
wrote:

>
>MrAsm skrev:
>> On Wed, 29 Nov 2006 10:30:30 -0500, Joseph M. Newcomer
>> <newcomer@flounder.com> wrote:
>>
>> >	throw new CALssBException;
>> >
>> >in the handler
>> >
>> >	catch(CALssBException * e)
>> >	    {
>> >                     ... deal with it
>> >	     e->Delete();
>>
>> Would it be better to throw without operator new (and catch by
>> reference &), so the exception destructor is automatically called and
>> there is no need for e->Delete() ?
>
>That is absolute the best way - throwing via new and catching by
>pointer is more than horrible!
>I do not know MFC very well and perhaps there is some reason still to
>use this method, but if there is not, you'd better use accepted C++
>idioms.

If you are deriving from CException, you must adhere to the MFC approach to
throwing and catching. Throwing CException objects by value is not
compatible with MFC and subjects you to the problems I described here:

http://members.cox.net/doug_web/eh.htm#Q6

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
12/3/2006 5:21:56 PM
Yes and no.  You can use the C++ mechanism, and std::exception, etc., but if you don't do
them right, you can get in trouble.  For example, there are catch(CException *) clauses in
the message pumps to prevent uncaught CExceptions from aborting the program.  If you have
a component that throws a non-CException-based exception, and you neglect to catch it, the
results will likely be fatal to your app, isntead of being merely annoying.

And while the decisions may have been forced by historical limitations, they now represent
the "way things are done".  

My question about the destruction deals with some odd corner cases I see.  I presume they
have all been solved.
					joe

On 3 Dec 2006 05:29:06 -0800, "peter koch" <peter.koch.larsen@gmail.com> wrote:

>
>Joseph M. Newcomer skrev:
>> See below...
>> On 2 Dec 2006 07:36:23 -0800, "peter koch" <peter.koch.larsen@gmail.com> wrote:
>>
>[snip
>***
>> Well, for those of us who do know MFC, we have to live with the idioms MFC uses.  And
>> those involve 'new'.  Why this is considered "good" I do not know, but if I want my
>> exceptions to be derived from CException and Play Well With Others, I have to use them in
>> the same way MFC uses them, even if it is not the ideal way.
>But how do you cope with non-mfc exceptions? Does using mfc prevent you
>from using libraries that follow the standard?
>BTW I believe a lot of the reasonig behind MFCs design is rooted in the
>inadequacy of the old Microsoft compilers (jokingly referred to Visual
>MFC++ by some).
>>
>> By the way, what happens to the temporary object used if you don't use 'new'?
>
>I am not sure I understand. The exception is destroyed like any other
>temporary would be. Is that what you mean?
>
>/Peter
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
12/4/2006 4:35:58 PM
Reply:

Similar Artilces:

Update on client side throws exception
Hi all, I'm updating a SQL Server 2008 database table using SqlDataAdapter/DataSets and Visual Studio C# on the client side. TARGET TABLE TO UPDATE: T_Order FIELDS: TAXOR [nvarchar] (255) NULL, TAXPARTSIZE [nvarchar] (255) NULL TAXSBO [nvarchar] (255) NULL TAXGRP [nvarchar] (255) NULL TAXSBGRP [nvarchar] (255) NULL SOURCE TABLE: ConusSolLyr FIELDS: TAXOR [nvarchar] (255) NULL, TAXPARTSIZE [nvarchar] (255) NULL TAXSBO [nvarchar] (255) NULL TAXGRP [nvarchar] (255)...

Join to get "exception" records
I have two queries Q1 and Q2 which have a common ID field. I want to get the records of Q1 except those where the ID exists in Q2. Is there a way to do this? TIA The Query wizard includes an "unmatched query" that will do what you are asking for. -- Hope that helps! RBear3 .. <john@john.com> wrote in message news:46310F54.2030007@john.com... >I have two queries Q1 and Q2 which have a common ID field. > I want to get the records of Q1 except those where the ID > exists in Q2. > > Is there a way to do this? > > TIA Cool! Thank you! RBear3 wrote:...

DispatchMessageW Exception
Our application is built by VS2005 in Visual Basic and run under dotnet framework 2.0. In the past few months, the application will abort randemly with the exception caught before and message "Faulting application hxmain.exe, version 2.0.3707.19991, stamp 4b849822, faulting module msvcr80.dll, version 8.0.50727.1433, stamp 471eb5ae, debug? 0, fault address 0x0001500a." reported in eventlog. The stack trace can't tell us where the application abort Exception Source: System.Windows.Forms Exception Type: System.AccessViolationException Exception Message:...

cannot save word file except tmp
I opened a word file I already worked before and updated and saved it - it is normal so far. After keeping working for a while, when I tried to save it, I got a message saying I cannot save it. The existing file name, while it is still open and i am working now, is suddenly changed to "xxxx.tmp". I had to save as with other name. I used MS Word 2007 Enterprise and worked under 2007 Office Groove. Any comments are welcome. Thanks, ...

ValidationEventArgs.Exception.SourceSchemaObject always null!
Here's my problem: I'm validating a XML file that I generate vs a static schema file, and am trying to get all the validation errors into a format that can be understood by a non-technical user. So I'm registering a ValidationEventHandler with the XmlValidatingReader's delegate, and can get the ValidationEventArgs just fine. Great. Problem is that I need to get the specific element out of the ValidationEventArgs.Exception object so that I can translate what the problem is into plain english for my non-technical users. But the ValidationEventArgs.Exception.SourceSchemaOb...

CString.ReverseFind() and throw
in the help of CString.ReverseFind(), it says int ReverseFind( XCHAR ch ) const throw(); what is this throw? if it is throwing an exception, how to catch it? thanks. WJ On Mon, 9 Jul 2007 14:48:02 -0700, WJ <WJ@discussions.microsoft.com> wrote: >in the help of CString.ReverseFind(), it says > >int ReverseFind( > XCHAR ch >) const throw(); > >what is this throw? if it is throwing an exception, how to catch it? thanks. > >WJ See: Exception Specifications http://msdn2.microsoft.com/en-us/library/wfa0edys(VS.80).aspx -- Doug Harrison Visual C++ MVP...

Should unimplmented pure function throw a compile error?
It's been a while since I have written anything with abstract classes. If I derive a class from my abstract class and do not implement a pure virtual function of the base class in the derived class, shouldn't the compiler throw an error? -- Bruce E. Stemplewski GarXface OCX and C++ Class Library for the Garmin GPS www.stempsoft.com yes, if you try to instantiate the class in your code it should. "Bruce E. Stemplewski " <BruceStemplewski@hotmail.com> wrote in message news:uaGJZhYCFHA.3732@TK2MSFTNGP14.phx.gbl... > It's been a while since I have written anyt...

LINQ Except function
In the following function, when the two xml strings passed in are identical, I get all of the "File" nodes from docRight. I was expecting zero file nodes. I must be using Except() wrong -- can anyone see what I'm doing wrong? public static string FindUniqueOnRight(string xmlLeft, string xmlRight) { XDocument docLeft = XDocument.Parse(xmlLeft); XDocument docRight = XDocument.Parse(xmlRight); var docAddFromRight = from r in docRight.Descendants ("File").Except( from l in docLeft.Descen...

Formula throwing up an error
Can anyone tell me why I should be getting an error. Range("L10:L7800").FormulaArray = "=IF(SUM(--('A Use'!A$1:A$10000&'A Use'!C$1:C$10000=B10&"G house")),"G house","")" B10 by the way is a relative reference. Thank you for your time. Look at where your double quotes are located; each set surrounds something that Excel will treat as a single string. Also, you will need a "&" between each string or variable. "=IF(SUM(--('A Use'!A$1:A$10000&'A Use'!C$1:C$10000=B1...

Rules exception
Here's a strange one: I have a client who is part of a larger organzation. They're constantly getting e-mails from "HQDA Exchange Administrator" that the larger organization is sending around to everyone. My users want to simply ignore these e-mails as they rarely have anything to do with us. I wrote up instructions for using the Rules Wizard to automatically delete the e-mails if "Exchange Administrator" is found in the senders from address. But, for some reason, the rule simply will not delete the e-mails. It will work with any other user name but seems to r...

MFG unhandled script exception error
When I was doing a Reverse Issue on the Manufacturing Component Transaction Entry window I received the following error when I posted: "Unhandled Script Exception: illegal address for field 'End Item Number' in script 'MOP_Reconcile'. Script Terminated". The transaction posted successfully, but I am wondering what caused the error. Does anyone know what this error means? Thanks for your help, Jocelyn ...

AfxOleInit throws an exception
Hi, I am doing a project for Unicode complaiance. The project setting are changed to _UNICODE. The application works fine in Debug mode. But when the configuration is changed to Release 'AfxOleInit' throws an exception. Any idea why this could happen ? Regards, ND Catch the exception and see what it says. try { AfxOleInit(); } catch (CException *pExp) { char Buffer[255]; pExp->GetErrorMessage(Buffer,255,NULL); MessageBox(Buffer); } AliR. "ND" <ND@discussions.microsoft.com> wrote in message news:615E05E3-CC6F-4A40-B18B-0D4233AC32CC@microsoft....

Throwing two dice and print out the total of each throw
in the days of line numbers i build a short programme to simulate the throwing of two dice with a screen print out the number of times, a particular number randomly came up . My question is can this run using Access VB ? Any constructive advise would be most welcome . The old code is as follows: REM THROWING 2 DICE CLS INPUT "How many Throws", N Dim A(12) FOR M = 1 TO 12 A(M) = 0 Next M FOR T = 1 TO N X = int(6 * rnd (1)) + 1 Y = int(6 * rnd (1)) + 1 Z = X + Y A (Z) = A(Z)+1 NEXT T CLS PRINT TAB(5); "Total" ; TAB(25); " Frequency" PRINT...

Addnew throwing error 3027
In one sub I am trying to add a record to to "Abstracts" table. Records in the abstracts table are related to the States and counties tables. So I open a recordset with joins. I have tried several times after checking everything out and cannot find any reason why the recordset should be read only. I have also checked for a lock file (as suggested in another post). The code: Private Sub cmdSave_Click() Dim strSQL As String Dim rs As DAO.Recordset Dim db As DAO.Database If blnCheckFields Then 'save new abstract Set db = CurrentDb() ...

Sum (throw out highest and lowest)
I am working on a contest scoring sheet for the California State Old Time fiddlers Association and it is contest policy to throw out the highest score and the lowest score and add the remaining middle (3) judges scores. (There are generally 5 judges - don't think there would ever be more than that.) The total of the middle three is used for future ranking points added to future scores, so "average" won't work in this application. Right now we are working this out manually - sure woudl be sweet to be able to have a formula that works it out for us. Thanks for any help. ...

XML Serialization of the Exception Class
I am attempting the following: XmlSerializer ser = new XmlSerializer(typeof(Exception)); I receive the following error: Message: There was an error reflecting type 'System.Exception'. Message: The property 'TargetSite' on type 'System.Exception' cannot be serialized because it is decorated with declarative security permission attributes. Consider using imperative asserts or demands in the property accessors. If I had ANY IDEA in the WORLD what this message is trying to tell me I would try to do something about this. Can anyone help me? Thanks In Advance d...

If my System.IO.StreamWriter Write method throws "The specified network name is no longer available." and I try to Dispose or Close it in the finaly clause the close or dispose method just throws "The
If my System.IO.StreamWriter Write method throws "The specified network name is no longer available." and I try to Dispose or Close it in the finaly clause the close or dispose method just throws "The specified network name is no longer available." again. how to clean this up? after this the stream writer is stuck connected until i restart my process. ...

throwing CException
I have extended CException into CMyException. I'm throwing it like this: if (error) throw new CMyException("Message", TRUE); How should I catch it? Is this OK: try { callSomeFunc(); } catch (CException &e) { char msg[999]; e.GetErrorMessage(msg, sizeof(msg)); AfxMessageBox(msg); return; } or I _have_ to use "CException *e"? Also, do I have to call e->Delete() and when? Is this OK: > try { > callSomeFunc(); > } catch (CException &e) { > char msg[999]; > e.GetErrorMessage(msg, sizeof(msg)); > AfxMessageBox(msg); > ...

CFile::GetStatus throws an exception when run from CD
I have a small app that is checking to see if the file dotnetfx.exe is present in the same directory as my executable. I am running VS.NET 2003 and using unmanaged C++. Everything works great, as long as my executable is not on a CD. When burned to CD, the call to GetStatus will throw "the parameter is incorrect". The strings are correct (and obviously it runs fine when not burnt to CD). CString strHelpFilePath = AfxGetApp()->m_pszHelpFilePath; int iFileLoc = strHelpFilePath.ReverseFind(_T('\\')); CString strFxLoc = strHelpFilePath.Left(iFileLoc + 1) + ...

this web site throwing blank pages
anyone else noting that this web site is throwing alot of unreachable web pages suddenly? Right now all my received email notifications of a reply ...the link on that email does not work to the reply.... Also alot of times during the sign-in it goes to nowhere.... -- NTC Yes, the sign-in always breaks/fails half way in and you need to reload to complete the process if using the Web interface. -- Daniel Pineault "NetworkTrade" wrote: > anyone else noting that this web site is throwing alot of unreachable web > pages suddenly? > > Right now all my receive...

CDO throwing Access Denied error in Outlook 2003
Hi, Whenever i access the Messages property of the Contact MAPI Folder, i am getting the following error Collaboration Data Objects Message : [Collaboration Data Objects - [E_ACCESSDENIED(80070005)]] What could be the prob? Thanks Bala I'm not sure what the problem is, your code works fine here but it does throw up the address book access security prompt before access to the contacts folder is allowed. Are you using the Beta 2 refresh? It's possible that access to contacts was more severely restricted in earlier beta versions, although I haven't seen any bugs abo...

Exception when deleting pointer in a struct
I have a program with a structure object that looks like this: typedef struct _MyStruct { CString Name; CString Path; CMyObj *pObj; HINSTANCE hModule; }MyStruct; I then initialize it as below: func() { MyStruct item; item.pObj = new CMyObj(); item.Name = _T("Some Name"); item.Path = _T("Some Path"); item.hModule = AfxLoadLibrary(_T("Mylib.dll")); if (!VerifySomething()) { //unload and cleanup delete item.pObj; //Exception occurs here AfxFreeLibrary(item.hModule); } } But, when I do the &...

Throws error on Outlook shutdown
Hi, I have 3 Add-In installed for Outlook which are developed in C#. When I follow a particular sequence by using these add-ins, I am getting error on Outlook shutdown. Please refer the following log errors, 005-10-13T08:29:45.858Z INFO GOSH CExecutor.DispatchEvent result is ABORT 2005-10-13T08:29:57.123Z INFO GOSH CExecutor.DispatchEvent result is FALSE 2005-10-13T08:29:57.139Z TRACE GOSH Shutdown GOSH framework OK 2005-10-13T08:29:57.733Z ERROR GOSH Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. at System.Drawing.SafeNativeMeth...

Out Of Office Exception
I want to setup an OOO and I thought there was a line of code or a switch you put at the bottom of your OOO message to send to outside SMTP's along with all the users in the network GAL. Something like: ***Out Of Office Exception*** Any help on this would be great. Thanks in advance. Benjamin Kirby <BKirby8677@sbcglobal.net> wrote: > I want to setup an OOO and I thought there was a line of > code or a switch you put at the bottom of your OOO > message to send to outside SMTP's along with all the > users in the network GAL. The Exchange administrators can en...

CTime.GetDay() unhandled exception
Hi, I'm not clear on how to use the CTime class correctly i use CTime o_Time; int n_Day = o_Time.GetDay (); i get an unhandled exception. What i want is to produce CString (s) 1) containing day-month-year 2) containing the current time RAN, You haven't initialised your variable. If you want the current time CTime o_Time = CTime::GetCurrentTime(); will do it. The easiest way to get a CString from this is to use CTime's own Format method CString cs = o_Time.Format("%d %B %Y"); will give you the date, eg "9 August 2007" and CString cs = o_Time.Format(&qu...