Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 17th, 2006, 2:32 PM   #1
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Arrow Fun with SHFILEOPSTRUCT

Hi all. I have this code in my program:
SHFILEOPSTRUCT fop;

      // initialize all data required for the copy
      fop.hwnd = NULL; 
      fop.wFunc = FO_DELETE; 
      fop.pFrom = "Documents and Settings\\All users\\Application Data\\Viewpoint\0"; 
      // fop.pTo = "A:\\";
      fop.fFlags = FOF_ALLOWUNDO;
      // remaining entries are output variables, no need to initialize

      SHFileOperation(&fop);
And it does what I tell it to do just fine and dandy. (by deleting the folder and all of it's contents)
However, when I try to put the same code in a different part of my source, and changing "fop" to "gop" (good old GOP :p ) and setting:
gop.pFrom = "Program Files\\Viewpoint\\Viewpoint Media Player\0Program Files\\Viewpoint\\Viewpoint Experience Technology\0";

Windows says it can't find the file! What am I missing here?
(This is all assuming that you put the .exe in your hard drive that Viewpoint is installed in)

Thanks.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Mar 17th, 2006, 3:18 PM   #2
Druid
Programmer
 
Join Date: Mar 2006
Posts: 40
Rep Power: 0 Druid is on a distinguished road
Do you have gop every where you originally had fop and is gop pointing to a valid / existing path?
Druid is offline   Reply With Quote
Old Mar 17th, 2006, 7:12 PM   #3
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
No, I have fop in one area and gop in another.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Mar 18th, 2006, 4:24 AM   #4
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 825
Rep Power: 4 The Dark is on a distinguished road
There are a couple of things I can think of, don't know if they are the problem though:

1. The help says
Quote:
pTo
Address of a buffer to contain the name of the destination file or directory. This parameter must be set to NULL if it is not used. Like pFrom, the pTo member is also a double-null terminated string and is handled in much the same way. However, pTo must meet the following specifications
Are you setting the pTo to NULL? You don't in the fop case, but you might just be "lucky" and it happens to be NULL anyways.

2. From the help again:
Quote:
If the pFrom or pTo members are unqualified names, the current directories are taken from the global current drive and directory settings as managed by the GetCurrentDirectory and SetCurrentDirectory functions.
Possibly something is changing your program's current directory before the gop version is called (e.g. a file open dialog). Try it with fully qualifies paths (i.e. stick c:\\ in front of both of the paths)
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:14 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC