CFanatic

Go Back   CFanatic > Programming > MFC Programming

Join CFanatic Forum Now

ShellExecute can't open files that WinExplorer can topic posted under MFC Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2006, 03:20 AM
Junior Member
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hsifelbmur is on a distinguished road
| More
ShellExecute can't open files that WinExplorer can

our application opens documents using shellexecute and the
following code:

lRet = ShellExecute(GetDesktopWindow(), sOperation, sFile, sArgs,
sDirectory, sShowCMD)

where...
GetDesktopWindow = Windows API function that returns a handle to the
desktop window
sOperation = "open"
sArgs = ""
sDirectory = vbNullString
sShowCMD = SW_SHOW = 5

Lately we have been having a few problems with this code: After working with our app for a few hours, during which the above code works fine, suddenly one of the following problems starts. These problems are completely random and non-reproducible, and happen only on some computers (different clients):

1. PDF documents just don't open: shellexecute returns 42 and does nothing. The same documents that don't open through our app open fine using Windows Explorer. When the close our app and re-start it everything works fine again.

2. HTML documents don't open either: shellexecute returns FILE_NOT_FOUND, even through the files exist and open fine using Windows Explorer. When the close our app and re-start it everything works fine again.

3. Word documents open fine, but for some reason, if we make changes to them and close Word, it doesn't prompt us to save. Some users have reports saving these documents (through Word - without our app's intervention), and seeing later that they were not saved. Needless to say, while this problems goes on with our app, the same documents open fine from Windows Explorer. When the close our app and re-start it everything works fine again.

We have looked everywhere and couldn't find an answer. Someone recommended passing NULL instead of GetDesktopWindow but this did not help.

Has anyone encountered this before?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
question about so files ftom2 C++ Programming 1 08-18-2008 02:28 AM
Writing/reading 'records' to/from files. rpaul Introduce yourself 1 11-10-2007 12:10 PM
how to read txt files in unknown folders zl2k MFC Programming 1 07-16-2007 12:48 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:19 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board