Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE and long names not being copied correctly

Status
Not open for further replies.

johnod33

Programmer
Mar 17, 2003
34
US
An OLE object stops working (can't find the object) when we update a server, copy the files from an old server to a new server.
In VFP6.0 (I think the entire 6.0 studio) when a file is named with a long name like this, "Surplus Inventory Summary by Division 3 Months Continuous Stock to dbf 5mth.RRW" the name is actually something like this SURPLU~3.RRW behind the scenes. I use an OLE control to point to this file. I have found that when more than 4 files start with the same 6 characters a different naming procedure is used before the tilde ~. Like it's truncating the original name. Something like this, SUEC4B~1.RRW.
When the files are copied from one server to the new server only the first 4 will work. The rest generate a error that the file cannot be found.
I know VB.net now uses the entire long name. Is there a version of Fox Pro that does this also?
Any time out IS dept updates a server I have to delete 100's of OLE controls and recreate them.
Any suggestions?
John OD
 
VFP uses long file names, but they will have to be in quotes if there are any embedded spaces in the path.

Anyway, your problem is not really a Fox issue, it's an NOS issue which needs to be addressed by whoever updates the server.
It is their responsibility to make sure the files get updated properly, otherwise you're just going to have to keep recreating them.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thanks Dave,

Yes I know about the quote marks for long file names in programs. I didn't think it had anything to do with Fox Pro. IS is always blaming everything on FP. :-(

I am just reaching anywhere to try and solve this issue. Thanks for taking the time to reply.

John OD
 
Are you able to use an alternative filenaming strategy?

Perhaps starting your file names with a unique number (creation date?).

I have seen similar things when trying to use Word by ole - you need to have the correct 8.3 naming convention.

Another alternative MIGHT be to get VFP to return the short filename (using a windows API call).

Code:
DECLARE LONG GetShortPathNameA IN win32api STRING LongFileName, STRING @ ShortFileName, LONG BUFFSIZE AS LONG

Regards

Griff
Keep [Smile]ing
 
Thanks Griff,

All this naming works fine using FP 6.0 and the OLE controls available. The probelm occours whe the files on the server are copied. Any long (unique) names up to 4 work ok. After that it no longer can find the file. I think I explained the way the names are above. MS says unique names will be incremented with a tilde and a number 1, 2, 3 and so on but after 4 the naming convention changes.
Examp:
SURPLU~1.RRW
SURPLU~2.RRW
SURPLU~3.RRW
SURPLU~4.RRW
SUEC4B~1.RRW
 
Hi,

If you have access to the source code, I was suggesting that you use the long filename - via the API call - to get the underlying short name. Armed with that, you should be able to get to your controls - regardless of what they are called.

To get the short name (the actual OS derived short name) use something like this:

Code:
DECLARE LONG GetShortPathNameA IN win32api STRING LongFileName, STRING @ ShortFileName, LONG BUFFSIZE AS LONG

function MyGetShortName
  parameters m.LongFileName
  private m.LongFileName,m.ShortFileName,m.Namelength
  M.ShortFileName= SPACE(255)
  m.Namelength= GETSHORTPATHNAMEA(m.LongFileName,@m.ShortFileName,255)
  IF m.Namelength> 0
     M.ShortFileName= TRIM(LEFT(m.ShortFileName,m.Namelength))
  else
     m.ShortFileName = ""
  ENDIF
return(m.ShortFileName)

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top