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
0
ND (8)
12/6/2005 8:44:02 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1251 Views

Similar Articles

[PageSpeed] 53

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.com...
> 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


0
AliR3470 (3235)
12/6/2005 4:17:43 PM
Hi,

The exception is not caught with  catch (CException *pExp). It is caught 
only if I give  catch (...). And with this I do not see any error message. 
How do I see the exact error message ?

ND

"AliR" wrote:

> 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.com...
> > 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
> 
> 
> 
0
ND (8)
12/13/2005 8:42:02 AM
Reply:

Similar Artilces:

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...

Newbe: Balances from online accounts throwing everything out (tearing hair out with this!!!)
Newbe question. Microsoft 2002 OK, I set up msm2002. Carefully enter bills and wages etc. Download my latest statement and painstakingly catogorise every transaction. log out of money safe in the knowledge that next time I go in I can simply import latest statement and it will tell me what I need to know. I go back to money one month later expecting to get budgeting info, cashflow statements and all the good dtuff I shelled out the cash for in the first place. I download a statement and straight away I can see that somthing awry. Moneys balence is masively different to what my bank says...

AfxOleInit() in App Class?
I have generated (AppWizard) a couple of projects in .net 2003 that use a legacy COM class. On execution the ConInitializeEX method fails due to the specified concurrency model. I tracked the problem back to the App Class which contained the following code in the InitInstance function: // Initialze OLD libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSEl } My COM connection works with the above code commented. The help specifies that the call uses the current apartment of the calling application. The legacy COM class is using COINIT_MULTITHREADED. Is ...

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. ...

Mailitem.Save() function throws an exception for POP3 messages
HI all, I have written a plugin to run on Outlook 2003/XP/2000 that will change the message class of every new mail that arrives to teh mail box. Changing of message class is crucial for me to apply a custom form for new mails I recieve. In the plug-in i have incorporated jthe following code "newMail" is any new message that reaches inbox and is of type "Mailitem" newMail.MessageClass = "IPM.Note.NewClass"; newMail.Save(); The above code works fine for all the type of mail accounts except for POP3 accounts(I have tested this with GMAIL Pop3 and yahoo Pop3). ...

Chart.Export throws COMException (0x800A03EC)
I can't get past this error. I'm using C#, creating a chart and want to export it. I've seen this here http://www.hightechtalks.com/csharp/chart-export-throws-comexception-0x800a03ec-235007.html But it doesn't give any steps to rectify the issue. Anyone have any ideas? I see that this is a pretty old post, but I just ran into the same issue and took me a while but finally figured out the solution. The Sintax for the Export method of the Chart object is: expression.Export(Filename, [FilterName], [Interactive]) as described at http://msdn.microsoft.com/en-us/library/aa1...

AfxMessageBox throws first chance exception
Hi, I have a problem in my MFC MDI app with loading files which are of the wrong format. (When using "All Files" option in the load dialog.) I try to catch files with the wrong extension in OnOpenDocument and show an afxmessagebox. However, I get an access violation when trying to do so. The same problem occurs in my doc's serialize function, where I use AfxThrowException to catch files of the wrong format. AfxThrowException also tries to display a message box and I get the same problem. I have stepped through the code - I get to here in CWinApp::DoMessageBox in the file APPUI1...

Merge worksheets
We run weekly reports that grow from week to week. We are looking for a method to take last weeks worksheet and merge with the latest worksheet. For example last weeks worksheet had 5 events, this weeks worksheet has 7 (5 of the 7 events are the same as last weeks events) - we only want to see the 2 new events. Any and all ideas are welcome. Can you pick out a unique id for each event? If you can, you could look at the new worksheet (with 7 events) and add a column to find out which events are carried over from the previous week. I'm gonna use sheet1 for last week's data and ...

difference between AfxOleInit() & CoUninitialize() ?
Hi to All, My Questions : 1. What is the difference between AfxOleInit() & CoUninitialize() in case of shell object? 2. In MFC appln, When i use CoInitialize(), then is it neccessary to UnInitialize it ? and if yes,where do i UnInitialize() it? waiting eagerly for replay. KC. If your app is dialog based you CoInitialize, show your dialog window and CoUninitialize all inside "InitInstance". In other cases, you initialize the same way but I believe you have ExitInstance to CoUninitialize. Not sure about the difference between AfxOleInit and CoInitialize(); "KC++"...

AfxOleInit() and CoInitializeEx in a non-GUI thread ?
Hi all, I'm currently trying to make sense of a DCOM interface in an app of ours. The COM server is run via STA (COINT_APARTMENTTHREADED) and we were thinking of changing it to MTA (COINT_MULTITHREADED). The interface exists to control certain aspects of the app from another program and doesn't do anything with the GUI of the app. Imagine an interface like this: library OurFooLib { interface IOurFoo : IDispatch { HRESULT SetClientName([in] long ClientID, [in] BSTR ClientName); HRESULT GetOpenProject([in] long ClientID, [out, retval] BSTR *pValue); ...

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...

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...