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
1642 Views

Similar Articles

[PageSpeed] 34

    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:

Access 2003 code does not run in Access 2007
On my form, I have 2 unbound txt boxes, one named Search_Name and One named Search_Town. There is a command button named CmdSearch. On clicking the CmdSearch, the following code runs. In previous versions of access, it returns all records with names and/or towns that are entered in the text boxes and filters out records that do not match the search criteria. Why does this code not nork in Access 2007? Private Sub CmdSearch_Click() 'myfilter is the variable to be built that will be the filter string Dim myfilter As String 'like is in there to allow near matches, not exact matc...

Validate Xml from Serialized Web Service Proxy Class throws on soap Array
Hi, im trying to validate objects before they are sent over the wire to a webservice, the schema embedded into WSDL is not sufficient so i took that schema and extended it with additional restrictions, after conversion from local domain class into remote domain class the remote class (generated from WSDL) is serialized to XML and validated using the schema, this throws "Undefined complexType http://schemas.xmlsoap.org/soap/encoding/:Array is used as restriction of complex type" (translated) How do i add this schema or map the soap array to another type? private void ...

exceptions not being caught under any circumstances
I have built a hello world console application that supports MFC. The following code correctly catches the exception and prints "exception happened". The compiler setting to support synchronous (/GX) and asynchronous (/EHa) both work as well. int main(int argc, char* argv[]) { try{ throw(1); } catch(...) { printf("exception happened"); } } I have a second application in which the above code NEVER catches the exception. Compiler,Linker and Preprocessor are all identical. I am also using MFC statically in both applications. The second application is a 1 meg executa...

Run-time Error 7
Hi: Every time that I open Microsoft Excel 2002 (opening a blank spreadsheet), I get a Visual Basic dialog box that says "Run-Time Error 7". It does not seem to be a problem, really. I just press the "End" button in this VBA dialogue box and Excel opens just fine. It's more of a nuisance than a problem. Does anyone know how to get rid of this box so that it doesn't pop-up? Thanks! childofthe1980s Hi There's a poorly written addin residing either in Excel's startup folder (see Tools > Options for location) or installed (See Tools > Addin for...

add 2 cells w/ 2 dec each, total=whole # except if answers is 2.9.
need a formula: 2 cells w/ 2 decimals each, total = whole # except if answers are between 2.96 - 2.99 range, does not want them to round up to whole # Hi Susan here's one option =IF(AND(A1+A2>=2.96,A1+A2<=2.99),A1+A2,ROUND(A1+A2,0)) Cheers JulieD "SusanN" <SusanN@discussions.microsoft.com> wrote in message news:732E7001-4F8B-4D2D-B966-AAB983F10066@microsoft.com... > need a formula: 2 cells w/ 2 decimals each, total = whole # except if > answers are between 2.96 - 2.99 range, does not want them to round up to > whole # > The correct formula ...

Outlook runs in the background
When I get in Outlook to check e-mail and then get out of Outlook, I have to completely reboot the computer before I can get back in Outlook. When I am shutting down, I get a screen that more or less says that Outlook is running in the background (although it doesn't show when I do Ctrl-Alt-Del). We have reinstalled Outlook, but it still hasn't helped. In Task Manager, on the Processes tab, do you see any instances on Outlook.exe or MAPISP32.EXE when this happens? Usually, Outlook not gracefully closing is caused by PDA software such as ActiveSync, FAX software, or other pr...

Running rules on mailbox other than the default
I seem to remember someone on her saying that rules in Outlook won't run on anything other than the default mailbox. I'm curious to know why that is and if anyone has ideas on how to get around that. My situation is as follows...I'm running Outlook 2003 that connects through Microsoft Exchange Server (I don't know which version). I have 3 different mailbox folders that I can access in Outlook: My personal mailbox (all the mail that comes in addressed to me), a mailbox for security issues (all the mail that comes in addressed to the security email), and another one for...

Script running isinteg -test for all mailbox stores on a server
Hi, Does anybody have a script for: 1. dismounting information stores 2. running isinteg for information store - output to a logfile 3. mounting information store again This would be a nice feature to run once and a while to check that everything is ok! Kind rgds Peter Jensen On Tue, 16 Aug 2005 10:33:17 +0200, "Peter Jensen" <peter.topp@mail.dk> wrote: >Hi, > >Does anybody have a script for: > >1. dismounting information stores >2. running isinteg for information store - output to a logfile >3. mounting information store again > >This would...

VB6 service under Server 2008 can't run another VB application
I have a VB6 service that has been running for years on 2000 and 2003. I'm trying get it to work on Server 2008 and it's not working. The service calls shell to run another VB6 .exe program. This .exe program is not being called when the VB6 service program is run as a service. If I run the program as an application, it works like it should. Obviously, something in 2008 needs to be changed to allow this but I don't know what it would be. sr Steve Ricketts brought next idea : > I have a VB6 service that has been running for years on 2000 and 2003. I'm...

Outlook throwing 'Access is Denied' errors when using My Documents shortcut #2
Hi, I have a problem with a few of our users which seems to be isolated to Outlook. All the workstations are running XP SP2 with Office 2003 (using Outlook in cached mode). Our setup is such that the users my documents automatically maps to a network folder - This works fine through explorer, but when trying to access it via Outlook (save as an attachment for example), it returns "Access is Denied" and fails to open the my documents folder. This works fine from other applications such as word. I had initially thought an update to McAfee VirusScan had solved this problem, but appar...

Cannot run Outlook
I am running windows XP Professional and have a BT Yahoo Broadband connection. I can operate Outlook express but cannot even open Outlook. It keeps telling me that my server is not available and jsut shuts down. I have used Outlook with Windows 2000 and the same broadband connection. Any suggestions? Have you tried the repair installation? David "Marshall-Dyckes" <anonymous@discussions.microsoft.com> wrote in message news:fd4201c3be2e$866d50f0$a601280a@phx.gbl... > I am running windows XP Professional and have a BT Yahoo > Broadband connection. I can operate Outloo...

Running code when hyperlink clicked
Hello, I am definitely baffled. I am trying to run code when a hyperlink is clicked. I am using Excel 2007, the hyperlink is created in a cell on Sheet 1 using "=hyperlink()", the hyperlink is to a video clip, and events are definitely enabled. I had tried two things, either of which would be fine: 1. I put the following code in Sheet1, and it did not respond at all. What am I doing wrong? Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) Sheets("Sheet1").Range("B1") = "It Ran" End Sub 2. I put the following...

problem burning cd
i have been trying to burn a cd on windows media player but once i have created my playlist which i made sure would fit onto the cd i simply get the message connect a burner and restart. i have a cd burner which i put the blank disk into so why cant i burn my cd? any help much apprciated On Tue, 23 Feb 2010 13:08:02 -0800, smooth <smooth@discussions.microsoft.com> wrote: >i have been trying to burn a cd on windows media player but once i have >created my playlist which i made sure would fit onto the cd i simply get the >message connect a burner and restart. i hav...

loaded office pro 07 1st cd & registed what about 2nd cd?
only promped for one cd ?????????????? I haven't loaded office from the retail cd so I can't be certain what the issue is. Did you select all the samples and other optional features? They may be on the second CD so you would only have to mount the second CD if you needed to install something from it. There may be other optional files that only need to be installed if your system needs them. Many options default to run from CD or install on first use so if you didn't change those to run from my computer, you may be prompted as you use the feature to mount the other CD. ...

How do I create a running report on Excel
I am trying to create a running production census for a medical facility. I just need to know how to get the data to automaticly contine with the ongoing numbers. If your data starts in A2, put the following formula in B2 and copy it down your sheet. =A2+B1 HTH, Gary Brown "Michellle M" <MichellleM@discussions.microsoft.com> wrote in message news:47144A4B-A4A6-4B5B-B9E1-20BD06743793@microsoft.com... >I am trying to create a running production census for a medical facility. I > just need to know how to get the data to automaticly contine with the > ongoing >...

Microsoft Run Time Error Mesaages
Please can someone help me or point me in the right direction over an ongoing problem I have. Whilst using the Internet, I constantly get a Microsoft Message pop-up on the screen saying the "Run-Time" Error has expired. No matter whether you click on "OK" or the red cross box in the top left hand corner of the message box, the internet is immediately shut down and you have to reopen it to continue. This is most annoying when you are in the middle of a specific function on the internet. Can someone please tell me how to rectify this problem. ...

Anyone get a Silverlight application to run in the Status Screen
I cannot get it to work. The friendly message of "This program cannot display the webpage" always appears when I add the silverlight app to the page. I turned off friendly messages in IE but that does not seem to change the message presented by store operations. Thanks KB ...

Run Query
Is there anyway in which I can run a select query, but only return say the first ten rows to save time? Running a query against a million records takes some time and whilst making ammendments I quickly want to review some of the returned formats (say the first ten). Ta Change the SQL statement from: SELECT ...... to SELELCT TOP 10 ..... For the TOP statement to work you need to have a sort field or ORDER BY clause. HOWEVER, it still needs to search through all the records. An index on the sorted field(s) can help. Better yet would by criteria or a WHERE clause to limit the records. ...

Two Domains, each running its own Exchange servers
This is a multi-part message in MIME format. ------=_NextPart_000_0242_01C63656.7A9FD3E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable How does one allow access to the mailbox of another domain which is on a = different Exchange box? For example, I'm logged into domain1 with AD2k3 and runnng Exchange 2k3 = using my Outlook 2k3; I want to access my mailbox which is in domain2 = with AD2k, running Exchange 5.5... I tried giving permission on the = other user account on the Exchange 5.5 by entering in "domain1\user" = under ...

run total in excel
Iis there a formula that will keep a running total in excel example: C2=5 B2=5 total in A2 =10 now if I change C2 to 8 then A2 will be 18 and if I change B2 to 12 then A2 will = 30 I dont want to use VBA if at all possible -- grizz Hi Grizzly In A2 type =c2+b2 Any number you will type in C2 & b2 will be added to A2 Regards John "grizzly6969" <grizzly6969@discussions.microsoft.com> wrote in message news:98451D4C-63CB-4913-A34A-9D327A3980A1@microsoft.com... > Iis there a formula that will keep a running total in excel > example: > C2=5 B2=5 total in A2 =10 ...

HELP: Running two Macros, one before the other
I have this Excel spreadsheet in which I want to automate, I have two macros once called Macro_GetData, and Macro_FormatData. Both these Macros work fine, but when I try to automate them it runs the 2nd Macro before the 1st Macro is even finish. I tried to use the "Application.Wait" command but that just stopped the macros entirely. What I want the macro to do is to run the first Macro (Macro_GetData) and when that's finished then run the second Macro (Macro_FormatData). The second Macro cannot work unless the first macro is completed. How can I go about doing this? Bobbak, It s...

Encountered errors while running Exmerge. Please Help!
I carefully followed Jim McBee's recipe for setting up ExMerge permissions (http://mostlyexchange.blogspot.com/2005/07/recipe-for-setting-up-permissions-to.html). However, I still couldn't get it working. I created a domain user and a global security group. I added the user to that security group. Then, I delegated the "Exchange view only administrator" right to the group over the First Administrative Group object (Of course, I added the required registry entry to enable the security tab). I also granted Send AS and Receive As right to the group over the Exchange store...

CD renewals
Hi, Is there a special way that Money handles CD renewals? I have a 1 yr CD. After the 1 yr, when the CD is renewed, how do I reflect the new interest rate? Thanks, Gary Do a Renew CD transaction (similar to Reinvest Interest)--it will setup a new investment that can have new data like interest rate. "Gary44" <gary.rose8@verizon.net> wrote in message news:ameAd.12585$fe5.4974@trndny06... > Is there a special way that Money handles CD renewals? > > I have a 1 yr CD. After the 1 yr, when the CD is renewed, how do I > reflect > the new interest rate? ...

Running macro when starting worksheet
Is there a way when you open a Excel Spreadsheet to automatically run before any manipulation of the file happens? Any help would be great. Thanks. C.Fillmore Two ways, Create a macro named Auto_Open or add the code to the Workbook_Open event in the ThisWorkbook code modeul. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "surveyorinva" <surveyorinva@discussions.microsoft.com> wrote in message news:FAB3C72E-4D69-49D0-A621-363DE617A035@microsoft.com... > Is there a way when you ope...

How to create a report with Frames running based on a linkage
Hi All, I want to build a SSRS report with two frames (or windows )in it. The way I want the report to work in on the left hand frame I will source data from a query to list products. When the user clicks on left hand frame on a product I want the right hand frame to list all sales for that product. I want to keep both the left and right frames to be visible. Please note the left frame is running a query creating a dataset something like this: SELECT ProductName From Products where region = p_region (the region is selected as a report parameter) I want the list of pr...