| |

VerySource

 Forgot password?
 Register
Search
View: 2862|Reply: 10

How to open the specified directory

[Copy link]

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-8 20:00:02
| Show all posts |Read mode
How to open the specified directory, I now need to design a button to open a specified directory, just like opening from "My Computer". How to write this code?
Reply

Use magic Report

0

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-4-3 22:30:01
| Show all posts
run ('explorer c:\path')
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-7-24 03:45:01
| Show all posts
Can the path be set as a variable? I need to read the path from the configuration file, but the method provided bytiger_marsseems to be fixed and cannot be changed.
Reply

Use magic Report

0

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-7-24 15:15:01
| Show all posts
string p
p ='c:\path'
run('explorer '+ p)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-26 14:00:02
| Show all posts
string ls_path = ""

integer li_result

li_result = GetFolder( "Select Folder", ls_path)


You can set ls_path to the folder you specify
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 United States

 Author| Post time: 2020-8-2 11:15:01
| Show all posts
What I need is to read the path from the configuration file. Thetiger_marsmethod does not work, and thewanyi971method cannot open the specified directory like "My Computer".

I use
string p = profilestring("xxx.ini","yyy","zzz","")
run('explorer '+ p)
Very strange
It can remember the profilestring ("xxx.ini","yyy","zzz","") value when the code is saved
For example, after the program is compiled, the value of profilestring ("xxx.ini", "yyy", "zzz", "") at that time is f:\
He can open F;\
When the value is changed to d:\, he still opens f:\
After compiling it to EXE, it is still f:\
:(
Reply

Use magic Report

0

Threads

21

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 China

Post time: 2020-8-2 15:30:01
| Show all posts
Alas, change your code to
string p
p = profilestring("xxx.ini","yyy","zzz","")
run('explorer '+ p)
Take a good look at this pb foundation.
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-8-6 18:30:01
| Show all posts
tiger_mars
I tried this a long time ago, and I can only call up the windows default directory, regardless of your p value
Use string p = profilestring("xxx.ini","yyy","zzz","") to define at least the p value at compile time
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-18 15:15:01
| Show all posts
//Set the new file path
Function ulong SetCurrentDirectory(ref string lpPathName) LIBRARY "kernel32.dll" ALIAS FOR "SetCurrentDirectoryA"
Please reset the application path to the current application path before reading.

SetCurrentDirectory(FilePath)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-19 18:30:01
| Show all posts
What if I need to open a shared folder on the network, and the GUEST user (or other user) of the machine where the shared folder is located has a password? If you use RUN (..) method to specify the user and password?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list