JoneZ Posted August 7, 2006 Share Posted August 7, 2006 Hi i want to create a folder in c:\Program Files and my code does this. But i am an administrator. If the person running my application is a user then they wouldnt be able to intall and it needs to ask for a administrator to intall. I've added the if statement but not sure if this will work or not. Any ideas would be appriciated. I also need to check if the dir is already created so it doesnt install over the top. Here is the code... if DirCreate ( @ProgramFilesDir&"\FFT" ) then FileCopy (@ScriptDir & "\FFT\school_FFT_DB_SCH.mdb", @ProgramFilesDir&"\FFT", 0 ) ; Sets a shortcut with ctrl+alt+t hotkey FileCreateShortcut(@WindowsDir & "\Explorer.exe",@DesktopDir & "\FFT Database.lnk",@WindowsDir,"/e,"& @ProgramFilesDir & "\FFT\school_FFT_DB_SCH.mdb", "FFT Database", @SystemDir & "\shell32.dll", "^!t", "43", @SW_MINIMIZE) MsgBox(4160,"Database Installation Complete"," The Database has been successfully installed to C:\Program Files\FFT." & @CRLF & "" & @CRLF & " A shortcut to this file has been placed on your desktop." & @CRLF & "" & @CRLF & "") else MsgBox(48,"Install Unsuccessful","Please contact your administrator to install the database") endif Link to comment Share on other sites More sharing options...
/dev/null Posted August 7, 2006 Share Posted August 7, 2006 Hi i want to create a folder in c:\Program Files and my code does this. But i am an administrator. If the person running my application is a user then they wouldnt be able to intall and it needs to ask for a administrator to intall.I've added the if statement but not sure if this will work or not. Any ideas would be appriciated.well, run it as a regular user without admin privileges and you will know if it works!CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
JoneZ Posted August 7, 2006 Author Share Posted August 7, 2006 well, run it as a regular user without admin privileges and you will know if it works!CheersKurtI was going to do that but was feeling lazy and a little . It's monday morning and i thought one of you coding gods could help ease the pain Link to comment Share on other sites More sharing options...
MHz Posted August 7, 2006 Share Posted August 7, 2006 You could run this code 1st. If Not IsAdmin() Then MsgBox(0x30, "", "Please contact your administrator to install the database") Exit EndIf Link to comment Share on other sites More sharing options...
JoneZ Posted August 7, 2006 Author Share Posted August 7, 2006 You could run this code 1st. If Not IsAdmin() Then MsgBox(0x30, "", "Please contact your administrator to install the database") Exit EndIf NICE ONE!!! You are the man! Didnt know about the IsAdmin function. Thankyou so much! Is there a function similar to that that will check if a folder is already in exsistance? Many thanks again. Tested as a basic user and it works. Link to comment Share on other sites More sharing options...
JoneZ Posted August 7, 2006 Author Share Posted August 7, 2006 NICE ONE!!! You are the man! Didnt know about the IsAdmin function. Thankyou so much!Is there a function similar to that that will check if a folder is already in exsistance?Many thanks again. Tested as a basic user and it works. I've found it it's FileExists()Cheers Link to comment Share on other sites More sharing options...
MHz Posted August 7, 2006 Share Posted August 7, 2006 (edited) Just use FileExist() to test if the folder does exist. Edit: Too slow, that's ok. Edited August 7, 2006 by MHz Link to comment Share on other sites More sharing options...
Briegel Posted August 7, 2006 Share Posted August 7, 2006 (edited) Whats the benefit of this? You know the users can't install the database so you must do it. Why don't you use 'RunAsSet()' and all users are able to install? Then you have time enough to .... EDIT: missing question marks :"> Edited August 7, 2006 by Briegel Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now