上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
jys
註冊時間: 2004-12-27 文章: 33 來自: 台灣
第 1 樓
|
發表於: 星期五 三月 25, 2005 8:54 am 文章主題: 請問有沒有方法可以得知目前執行檔所在位置 |
|
|
因為會從其他程式呼叫由Foxpro所產生的執行檔,我用 sys(5) + curdir() 所得到的路徑是呼叫本執行檔的所在路徑 |
|
回頂端 |
|
 |
jys
註冊時間: 2004-12-27 文章: 33 來自: 台灣
第 2 樓
|
發表於: 星期五 三月 25, 2005 9:17 am 文章主題: |
|
|
找到一個方法 LOCFILE() 可以找到我的執行檔所在位置 |
|
回頂端 |
|
 |
jys
註冊時間: 2004-12-27 文章: 33 來自: 台灣
第 3 樓
|
發表於: 星期五 三月 25, 2005 9:35 am 文章主題: |
|
|
但是若客戶將執行檔更改名稱時就無法得知了,還有其他方式嗎? |
|
回頂端 |
|
 |
小桑•無痕

註冊時間: 2003-07-08 文章: 304 來自: Tainan, Taiwan
第 4 樓
|
發表於: 星期五 三月 25, 2005 9:43 am 文章主題: |
|
|
試試 SYS(16)、JUSTPATH()
SYS(16) - Executing Program File Name
Returns the file name of the program being executed. You can use SYS(16) to recover from errors.
JUSTPATH(cFileName)
Returns the path portion of a complete path and file name. _________________ 用力 Try 一下...可以發現很多好玩的事.... |
|
回頂端 |
|
 |
garfield Site Admin

註冊時間: 2003-01-30 文章: 2160
第 5 樓
|
發表於: 星期五 三月 25, 2005 10:09 am 文章主題: |
|
|
? program(0) &&--執行檔名
? SYS(5) + SYS(2003) &&--執行檔目錄 _________________ 利用>>搜尋<<的功能會比問的還要快得到答案. |
|
回頂端 |
|
 |
小桑•無痕

註冊時間: 2003-07-08 文章: 304 來自: Tainan, Taiwan
第 6 樓
|
發表於: 星期五 三月 25, 2005 11:40 am 文章主題: |
|
|
garfield 寫到: | ? program(0) &&--執行檔名
? SYS(5) + SYS(2003) &&--執行檔目錄 |
代碼: | program(0) Returns the name of the program currently executing
Remarks
SYS(16) is similar to PROGRAM( ) except that SYS(16) returns a path with the program name. When the executing program is part of an application (.app), SYS(16) returns only the name of the program, that is, without the path. SYS(16) returns the name of the executable file if called from an executable (.exe) file; whereas PROGRAM( ) returns just the program name. If a procedure or function is being executed, SYS(16) returns the name of the file containing the procedure or function after the procedure or function name.
EX:
Project Name:專案1
Main.PRG (Set Main)
ON SHUTDOWN QUIT
SET SYSMENU TO
SET SYSMENU OFF
? "program(0)/program(1):" + program(0) + "/" + program(1)
? "SYS(5) + SYS(2003):" + SYS(5) + SYS(2003)
? "SYS(16):" + SYS(16)
? "JUSTPATH(SYS(16)):" + JUSTPATH(SYS(16))
READ EVENTS
Build 專案1.EXE
RUN 專案1.EXE
program(0)/program(1):MAIN/MAIN
SYS(5) + SYS(2003):D:\TEST_MENU
SYS(16):D:\TEST_MENU\專案1.EXE
JUSTPATH(SYS(16)):D:\TEST_MENU
RENAME 專案1.EXE 專案2.EXE
RUN 專案2.EXE
program(0)/program(1):MAIN/MAIN
SYS(5) + SYS(2003):D:\TEST_MENU
SYS(16):D:\TEST_MENU\專案2.EXE
JUSTPATH(SYS(16)):D:\TEST_MENU |
_________________ 用力 Try 一下...可以發現很多好玩的事.... |
|
回頂端 |
|
 |
小桑•無痕

註冊時間: 2003-07-08 文章: 304 來自: Tainan, Taiwan
第 7 樓
|
發表於: 星期五 三月 25, 2005 11:48 am 文章主題: |
|
|
補充一下:
SYS(5) + SYS(2003) 取出來的是程式(.EXE)目前工作的目錄(程式一開始執行時,是等於捷徑中的「開始位置」)
JUSTPATH(SYS(16)) 取出來的是程式(.EXE)的實際目錄 _________________ 用力 Try 一下...可以發現很多好玩的事.... |
|
回頂端 |
|
 |
jys
註冊時間: 2004-12-27 文章: 33 來自: 台灣
第 8 樓
|
發表於: 星期五 三月 25, 2005 1:41 pm 文章主題: |
|
|
謝謝各位的幫忙,JustPath(Sys(16)) 已解決我的問題 |
|
回頂端 |
|
 |
garfield Site Admin

註冊時間: 2003-01-30 文章: 2160
第 9 樓
|
發表於: 星期五 三月 25, 2005 6:48 pm 文章主題: |
|
|
又學了一招 SYS(16), 都沒有很認真看help的說.... _________________ 利用>>搜尋<<的功能會比問的還要快得到答案. |
|
回頂端 |
|
 |
|