|
-
Dec 4th, 2000, 06:16 PM
#1
Thread Starter
Fanatic Member
Why Doesn't This Work
Code:
FileCopy App.Path + "\LSS.exe", GetWinDir(144) + "\"
Why doesn't that code work?? Please try it and see what it gives you!
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Dec 4th, 2000, 06:28 PM
#2
Hyperactive Member
GetWinDir() is not a VB function.
-
Dec 5th, 2000, 06:39 AM
#3
Thread Starter
Fanatic Member
this is what I have in a module!
Code:
Public Declare Function GetWindowsDirectory _
Lib "kernel32" Alias "GetWindowsDirectoryA" _
Public Function GetWinDir(dir As Integer) As String
Dim WinDir As String * 255
Dim StrLn As Long
WinDir = Space(255)
StrLn = 254
Call GetWindowsDirectory(WinDir, StrLn)
Trim$ (WinDir)
GetWinDir = WinDir
End Function
and then I want to copy the current file that is running to the windows directory using this code
Code:
FileCopy App.Path + "\LSS.exe", GetWinDir(144) + "\"
And it gives me a Path/File Access Error!
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Dec 5th, 2000, 08:39 AM
#4
Question...
Why Are you passing a variable to your getwindir finction? It's not being used.
But anyway use the & not +
Code:
FileCopy App.Path + "\LSS.exe", GetWinDir(144) & "\"
Try this:
Code:
Dim FindWinDir as string, WinDir as string
WinDir = Space(144)
FindWinDir = GetWindowsDirectory(WinDir, 144)
WinDir = Trim(WinDir)
FileCopy App.Path + "\LSS.exe", WinDir & "\"
Hope this helps!
:P
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|