Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Open/Read/Write using CFile in a COM Object.

Posted on 2005-03-06
Medium Priority
Last Modified: 2013-11-25
I have a COM Object that uses a CFile object to open a text file, read it, and write to it.  In my development environment it works great.  However, the released version of the COM Object will not create or edit the TXT file on the client's PC.  I've also tried deploying the Debug version of the COM Object just to ensure that would have no impact on the problem, which it didn't.  I can't post MessageBoxes due to the nature of the COM Object and so I can't see what code is returned via CFileException.  I'm thinking it's a rights issue.  I'm hoping that I won't have to setup a full debug environment on the client PC just to determine what's up with this issue.  The target PC is running Windows Server 2003 but I have also seen the same problem on a Win XP Pro PC.  I can post source code if need be but, since it is working great locally, I don't think the source code is the issue.  Is there something I should do on the target PC to allow my application to perform file I/O?  Any ideas are appreciated.
Question by:Xolutionz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 48

Accepted Solution

AlexFM earned 750 total points
ID: 13474306
Handle all CFile exceptions properly and write information about them to log file. You can also use OutputDebugString function to report exceptions and see them using DbgView program from Generally, your program is not OK if it doesn't work and you don't know why. It must report by some way error information.
Try to run COM object client under Administrator account, possibly there is a problem with directory permissions.

Author Comment

ID: 13476877
I've thought about asking the client to login as Administrator and try it again, which would verify whether it's a permissions problem or not.  I'll also investigate the other debugging tool that you've described.  Thanks for the advice.

Author Comment

ID: 13508593
Sorry -- I forgot to update this thread.  I figured out the problem.  I had to right-click on the specific directory and grant full permissions to Everyone.  That fixed it.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question