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) +
_T("dotnetfx.exe");

     CFileStatus oStatus;
     BOOL bFxPresent = FALSE;
     try {
          bFxPresent = CFile::GetStatus(strFxLoc, oStatus);
     }
     catch (CException *ex) {
          ex->ReportError();
          ex->Delete();
          bFxPresent = FALSE;
     }

====================================================
Walter Williams
Software Engineer
Sawtooth Software, Inc.
http://www.sawtoothsoftware.com
---------------------------------------------------- 
"Do, or do not. There is no try."



0
1/15/2004 11:43:37 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
1417 Views

Similar Articles

[PageSpeed] 3

    If you call ex->GetErrorMessage() inside the catch() what does it tell
you ?

-- 
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

"Walter L. Williams" <sparticus1701@hotmail.com> wrote in message
news:OGLIpF82DHA.1428@TK2MSFTNGP12.phx.gbl...
> 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) +
> _T("dotnetfx.exe");
>
>      CFileStatus oStatus;
>      BOOL bFxPresent = FALSE;
>      try {
>           bFxPresent = CFile::GetStatus(strFxLoc, oStatus);
>      }
>      catch (CException *ex) {
>           ex->ReportError();
>           ex->Delete();
>           bFxPresent = FALSE;
>      }
>
> ====================================================
> Walter Williams
> Software Engineer
> Sawtooth Software, Inc.
> http://www.sawtoothsoftware.com
> ---------------------------------------------------- 
> "Do, or do not. There is no try."
>
>
>


0
CheckAbdoul
1/16/2004 12:28:56 AM
It's the same thing as ReportError(); the error is "The parameter is
incorrect."


"CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
news:OUYddf82DHA.3656@TK2MSFTNGP11.phx.gbl...
>     If you call ex->GetErrorMessage() inside the catch() what does it tell
> you ?
>
> -- 
> Cheers
> Check Abdoul [VC++ MVP]
> -----------------------------------
>
> "Walter L. Williams" <sparticus1701@hotmail.com> wrote in message
> news:OGLIpF82DHA.1428@TK2MSFTNGP12.phx.gbl...
> > 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) +
> > _T("dotnetfx.exe");
> >
> >      CFileStatus oStatus;
> >      BOOL bFxPresent = FALSE;
> >      try {
> >           bFxPresent = CFile::GetStatus(strFxLoc, oStatus);
> >      }
> >      catch (CException *ex) {
> >           ex->ReportError();
> >           ex->Delete();
> >           bFxPresent = FALSE;
> >      }
> >
> > ====================================================
> > Walter Williams
> > Software Engineer
> > Sawtooth Software, Inc.
> > http://www.sawtoothsoftware.com
> > ---------------------------------------------------- 
> > "Do, or do not. There is no try."
> >
> >
> >
>
>


0
1/16/2004 3:51:15 AM
>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".

Walter,

I think someone raised an issue that sounds surprisingly similar to
what you're seeing just a few weeks ago (I can't remember the precise
date). Try searching the Google groups archives to see if you can find
that thread and see if there was a resolution given.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl (422)
1/16/2004 11:54:52 AM
>I think someone raised an issue that sounds surprisingly similar to
>what you're seeing just a few weeks ago

The thread was in this newsgroup, subject was "CFile::GetFileName
throws an exception". I hope this URL doesn't get corrupted:

http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=OZuXYRzWDHA.536%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fq%3D%2522CFile%253A%253AGetFileName%2Bthrows%2Ban%2Bexception%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den

If you can debug into the MFC code, see if you think this is the same
issue (or not).

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl (422)
1/17/2004 1:14:28 AM
I get the same exception when I try to save a file on a Win9x shared folder from a WinXP Machine.  Of course your the only one other than me who was able to reproduce the problem.  


0
anonymous (74722)
1/29/2004 4:31:09 PM
Reply:

Similar Artilces:

CFile::Read...
I am working with MFC VC++6 and want to read a file that I created and display the contents of the file to a message box. The file has one character 'a' at position 1. Here is my code: const int MAX_STRING_LENGTH = 10; CString MyString; MyFile.Open("...MyfilePath", CFile::modeNoTruncate | CFile::modeRead ); char* TempBuf = MyString.GetBuffer(MAX_STRING_LENGTH); UINT NumChars = MyFile.Read((void FAR*) TempBuf, MAX_STRING_LENGTH - 1); MyString.ReleaseBuffer(NumChars); AfxMessageBox(MyString); Unfortunately I get an exception error. Does anyone know what I am doing w...

Excel export to Access
I have Office 2003 and would like to export cell contents to an Access table I've created using an Excel worksheet button. The code below works when there are only 14 cells but bigger than that I get "method range of object worksheet failed. Run-time error 1004." arrrg. Private Sub CommandButton5_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim MyCn As ADODB.Connection Dim SQLStr As String Set MyCn = New ADODB.Connection MyCn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ= C:\temp\QCRData FY2010.mdb" ' Replace actual Access file p...

average with exception of some cells?
How can I exclude a few cells in calculating the average, maybe if it has color or whatever the best way to distinguish it from the rest? I can probably manually delete them first, write down the average, revert to previous, but it is not automatic. Thanks, Hi Values in A1:A10, in column B you can mark values to exclude from the calculation with an 'x', and use this formula to calculate the average: =SUMPRODUCT(A1:A10,--(B1:B10<>"x"))/COUNTIF(B1:B10,"<>x") Regards, Per "cpliu" <spamfreeliu@yahoo.com> skrev i meddel...

Office (except Entourage) does not start after Updating to Panther.
> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3154584288_141446 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: 8bit After trying to start any of the office programs under X 10.3, i only get the start-window and the spinning wheel. After a little while i get an error message, the program could not be started. I tried to update to versions 10.1.4 an 10.1.5 (only excel and powerpoint), no effect. I also repaired my disk permissions... I have another office-cop...

GP server running at 100%
Our GP server has been running at 100% for the last two days and is causing everything to be really slow. sqlserver.exe is using 99 "CPU" and is using 1.7 GB of memory of the 3GB available on the server. First of all, any ideas on how to lower this? I don't know what caused the server to run so slow in the first place, but we have a lot of SQL server reporting services subscriptions that run every night, and these are now backed up. Is there some way to clear out some sort of queue so that these reports will not, thus giving the server one less thing it is trying to do? These...

Still Receives Mail When Not Running
I'm using Outlook XP as my email client, when I leave the office I exit Outlook so it won't be running and receiving email, allowing me to check email remotely via webmail interface. However I've noticed that I get no new messages when doing this webmail checking, as Outlook is somehow still receiving the email even though it is not running (but the computer is still on). Any ideas how to stop Outlook checking and receiving new email messages when it shouldn't be running? Many thanks - Andrew If you have Outlook as your email client, and you use an Exchange account, t...

Pivot Table (Running averages)
Using a pivot table I need to create a running average of values for the last 10 days. It's easy to display the averages for each day and filter off everything but the last 10 days BUT... I can't get a running average working. The goal is to develop a dynamic graph/chart that shows the average with a trend line for the running average to see if things are improving. There is a built in function for running totals but I need the average of the previous numbers not the totals. I am somewhat familiar with calculated fields but am not smart enough to pull it all together to make th...

help cfile
I have a simple question This is what i have char* pFileName = "C:\\newspaper\\b run\\text.txt"; CFile f( pFileName, CFile::modeCreate | CFile::modeWrite ); loop...... CString out =(buff2+ current->address);<- right here i would like a return f.Write(out,out.GetLength()); ......... f.Close(); what i would like to know is how do i advance to the next line I have tried CString out = (buff2+ current->address+"\n"); well mabe i just have to revert back to the ofstream then cout << endl thanks kevina@ihug.com.au Use "\r\n". tankc &quo...

Running problem
VWD 2010 I copy all my asp project into a physical location in my pc. Set up a virtual directory under IIS. Open the browser for the main page. eg http://localhost/TestSite20100707/main.aspx Got the error on the page showing the webconfig contents: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute name...

Pivottabel / running totals / year-to-date
Hi I have sales figures that I would like to show in a chart where I have the current month and year-to-date totals. Using a dropdown/validation list with 12 months my boss is able to see the numbers by just changing the month. In different sheets I have to separate pivot tables. My problem is this: In one of my pivot tables there are no sales in March so when my boss wants to see the year-to-date total for March - accumulated sales from January and February is not included. If he choose April then the total is correct because there are sales in April. Hope some can help me out and unders...

Money 2003 deluxe will not copy to CD
Just as I have said money 2003 will not copy to a CD. It says Microsoft has encountered a problem while copying money any help would be appreciated. There are no passwords installed nor is the program running while I'm trying to copy. If there was a question here, it wins the cryptic question of the day award. The data file won't copy? The application won't copy? You are using Money to try to "copy"? You are using Windows to try to copy? FWIW, Money knows absolutely nothing about burning CDs. It only knows about floppy disks (and a CD is definitely not a floppy d...

delete and exception
I have a problem with a delete and I am trying to know what kind of exception. try { delete [] pArray2Flush; } catch ( ...) { ????? How can I know the exact exception } "mosfet" <tricubes@wanadoo.fr> wrote in message news:c0ipt6$5ab$1@news-reader3.wanadoo.fr... > I have a problem with a delete and I am trying to know what kind of > exception. > > try > { > delete [] pArray2Flush; > } > catch ( ...) > { > ????? How can I know the exact exception > } If you want to write proper C++, the destr...

Formula to show numbers except two
Hi, I have this data in column A that changes each time. A 10 15 I have only the first 2 numbers that go from 10 to 17. I need a formula that from A3 on throws all the numbers from 10 to 17 except the first two. For example, in this case, I have numbers 10 and 15, the formula should show: A 10 15 11 12 13 14 16 17 If I had 12 and 17, it shoul show 10, 11, 13, 14, 15 and 16. Hope my question is clear. Thanks Will the 2 numbers ever be the same: A1 = 17 A2 = 17 Will the the 2 numbers *always* be listed in ascending order? Will this ever be a possi...

CFile
hi, i want to read the contents of a text file and to replace the occurance of a particular word. i have used CFile.read and the contents of the file is stored in a character variable,say buffer[100]. now how can i search for a word and replace it. anu Use CStdioFile and read each line into a CString variable. Then use CString:Replace() to find the word and replace. -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "anu" <anu@transversalnet.com> wrote in message news:0c6801c34552$36b6f2a0$a501280a@phx.gbl... > hi, > > i want to read t...

Wake Computer to Run Task Turns Off
::Wake Computer to Run Task-:: ::I use Vista Home Premium.:: ::When I use Task Scheduler to run Windows Defender or McAfee Virus Scan I select �Wake Computer to Run Task� from the Sleep mode. The tasks are runned as scheduled, but afterwards, the �Wake Computer to Run Task� is unchecked and I have to recheck it again to run the scheduled tasks.:: ::What needs to be done to keep this command from turning off?:: ::Thanks,:: ::Jerry:: -- Jerry8A ...

Running a continuous VBA loop while allowing the user to click but
I want to run a VBA loop that increments a progress bar but allow the user to click buttons on the same Window that activated the loop to perform various actions. I've tried the standard Timer loop using DoEvents but sometimes clicking the buittons works and sometimes it doesn't. Any suggestions? On Thu, 3 Jun 2010 15:22:14 -0700, David W <DavidW@discussions.microsoft.com> wrote: The timer event is very low priority, so even if you specify it to tick every 1000 msec that won't necessarily happen if you're in a tight loop. The only way to make the UI more r...

Exception thrown inside AfxWndProc
I've had a dump file that have the following call stack. mfc42u!AfxCallWndProc+0x8b mfc42u!AfxWndProc+0x36 CapPRG!AfxWndProcDllStatic+0x2e .... .... CapPRG!CapPRGStatic::showUp+0x25 CapPRG!CapPRGMainDlg::OnInitDialog+0x7fa Basic what is happening is that inside CapPRGStatic::showUp(), function CWnd::MoveWindow() is called, which generats a window message WM_WINDOWMOVING which is send to AfxWndProcDllStatic for processing. The direct cause of the exception is inside function (MFC4.2) AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { // special message which identifies the...

Public Folder Replication not running
We have two exchange 2000 servers in the same exchange organization, same active directory domain. We have one set of public folders that have been configured to replicate to both servers. We would create public folders on one server and then they replicate to the other server immediately (replication interval set to "always"). But last week the replication suddenly stopped for new folders, although existing ones still appear to replicate their contents. When we create a new folder on one server, and set it in system manger to replicate to the other server, replicas never appear ...

Serialize CFile
Hi, May I know is it possible to serialize a CFile object in CDoc? If so, how can I do it? I have tried to create a CFile m_file in CDoc, then in Serialize, call m_file.Serialize(ar). But it seems like nothing is saved. Pls enlighten, thank you. <lynnzyeo@yahoo.com> wrote in message news:1142763157.155959.302050@v46g2000cwv.googlegroups.com... | Hi, May I know is it possible to serialize a CFile object in CDoc? If | so, how can I do it? I have tried to create a CFile m_file in CDoc, | then in Serialize, call m_file.Serialize(ar). But it seems like nothing | is saved. Pls enlighten, t...

Running 97 & 03 apps on same machine
Hi: Can an ACCESS 97 and 03 runtime app be used on the same machine, and if so, how do I do this. Thanks in advance, Steve Sure. Many of us do that. Presumably you already have A97 on your machine. Do a custom install of A2003. It does into a different folder, and you can tell it not to remove the previous version(s). If you are then converting A97 databases to A2003, check out this article: Converting from Access 97 to 2000, 2002 or 2003 at: http://members.iinet.net.au/~allenbrowne/ser-48.html -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users...

Will Access 2003 allow database to run on PC w/o Access?
Can I create a data base in Access 2003 and put it on PC's that do not have Access installed? It seems you once had to buy the developers edition of Access to do this... but I thought I heard that Access 2003 allowed creation and distribution of "stand alone" data bases. Thanks for any help. Sorry, you heard wrong. No version of Access has ever been able to create stand alone databases. For more information, check what Tony Toews has at http://www.granite.ab.ca/access/developereditionfaq.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no...

Timeout when running a large export to Excel
I had at a customer today "time outs" when trying to export 10,000 records to excel. The fix was to place: <httpRuntime executionTimeout="900"/> in the system.web section of the ms crm web.config. This fixed the problem Kind Regards Mike Mike: Thank you for your answer... because I am retarded... where in teh file below do I add your line of code <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <compilation defaultLanguage="C#" debug="false"> <assemblies> ...

controls are distorted when run on a pc with different resolution
hello the controls on the main dialog box are distorted when I run it on a different PC. But when I run it on the PC I am coding with it works alright. How can I correct this dspman wrote: > hello > > the controls on the main dialog box are distorted when I run it on a > different PC. But when I run it on the PC I am coding with it works alright. > > How can I correct this Windows resizes controls based on the size of the font selected by the user in Control Panel, Display, Advanced. That is probably the source of your issue. If it looks terrible then about al...

Importing text file into Excel 2003 - C#
Hi all, I am a newby in Excel programming so my question could be an easy one. I found lots of VB code snippets on this issue but almost none in C#. I want to import in a new Excel 2003 doc a character delimited text file. Here is my code: Excel.Workbook lWB = this.excelApp.Workbooks.Add(System.Reflection.Missing.Value); Excel.Worksheet lWS = (Excel.Worksheet)lWB.ActiveSheet; string myfilename = "TEXT;C:\\tmp\\test.txt"; Excel.Range lRange = lWS.get_Range("A1","A1"); /////// the following call generates: System.ArgumentException - The p...

Macros-start dynamics, run process and exit
I have recorded a macro that logs into dynamics, rebulds a sales forecast combination and then is supposed to exit (close out) Dynamics Everything works fine, except Dynamics GP does not exit at the end. When I recorded the macro I did go through the 'Exit' to close Dynamics, but when the macro runs, it does not exit and there are no windows open or messages. i have added the logging file to the macro also. Am I missing something? thanks! -- Doug Doug, Your macro must include the following line to be able to quit GP. CommandExec form BuiLtin command cmdQuitApplication ...