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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File question

Status
Not open for further replies.

vacunita

Programmer
Aug 2, 2001
9,166
MX
This is how its supposed to work: The user double clicks a file in explorer and my application loads and opens the file. The only problem is that when i try to read the file form the ParamStr. i get only part of the path, say the file is in
C:\Documents and Settings\User\Desktop\FileToOpen.rpt
when i read the ParamStr(1) i only get C:\Documents.
i could use ParamCount and concatenate all the parameters in ParamStr but the problem arises when besides the file parameter i get an action parameter that specifies what to do with the file. for example i get
C:\Documents and Settings\User\Desktop\FileToOpen.rpt -p
if i get that i parse the file, but if i concantenate all the paramstr i would get a file that looks like
C:\Documents and Settings\User\Desktop\FileToOpen.rpt-p and that would be an invalid file to parse or do whatever

If anyone knows a way to get around this problem i'd appreciate it.

thanx


 
Sort the input strings by checking the syntax. When the file name is added together use 'FileExist' to verify it.
 
I assume that you have also created a association with the .rpt extension to make this work, so every filename will end in .rpt, if so, You could look for the last occurrance of .rpt in the string and know that the file name is everying up to that point, and the paramters are after it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top