Code:
#COMPILE EXE FUNCTION PBMAIN DIM a AS ASCIIZ * 1024 a = "abc" CALL MyFunction(BYCOPY a) END FUNCTION FUNCTION MyFunction(b AS ASCIIZ) AS LONG MSGBOX b END FUNCTION
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
#COMPILE EXE FUNCTION PBMAIN DIM a AS ASCIIZ * 1024 a = "abc" CALL MyFunction(BYCOPY a) END FUNCTION FUNCTION MyFunction(b AS ASCIIZ) AS LONG MSGBOX b END FUNCTION
#Compile Exe #Include "\!include\win32api.bas" Function FSO_GetRoot(ByVal Path$) As String Local Tmp$,FS$,SH$ Tmp$ = UCase$(Path$) If (Mid$(Tmp$,1,1)>= "A" And Mid$(Tmp$,1,1)<="Z") And (Mid$(Tmp$,2,1)=":") Then Function = Mid$(Path$,1,2) & "\" ElseIf Mid$(Path$,1,2)="\\" Then FS$ = Rtrim$(Parse$(Path$,"\",3)) SH$ = Rtrim$(Parse$(Path$,"\",4)) If Len(FS$)< 2 Then Function = "":Exit Function Tmp$ = "\\" & FS$ & "\" If Len(SH$) < 1 Then Function = Tmp$:Exit Function Function = Tmp$ & SH$ & "\" Else Function = "" End If End Function Function FSO_FolderExists(ByVal FolderSpec$) As Long Local fd As WIN32_FIND_DATA Local fAttr As Dword Local hFind& If Len(FolderSpec$)=0 Then Function = %false:Exit Function If Right$(FolderSpec$,1)= "\" Then FolderSpec$ = Left$(FolderSpec$,Len(FolderSpec$)-1) hFind& = FindFirstFile(ByVal StrPtr(FolderSpec$), fd) If hFind& = %INVALID_HANDLE_VALUE Then Function = %false :Exit Function Call FindClose(hFind&) fAttr = fd.dwFileAttributes Function = %True 'Directory|NotTemporary If (Bit(fAttr, 4)=0) Or (Bit(fAttr,8)=1) Then Function = %false End Function Function FSO_CreateFolder(ByVal PathSpec$) As Long Local Tmp$,Root$,Rest$,cnt&,i% Dim DirPath()As String ReDim DirPath(1 To 1)As String If Right$(PathSpec$,1)= "\" Then PathSpec$ = Left$(PathSpec$,Len(PathSpec$)-1) '--Skapa Root/Rest------------------------------- If IsFalse FSO_FolderExists(PathSpec$) Then Root$ = FSO_GetRoot(PathSpec$) Rest$ = Remove$(PathSpec$,Root$) If Len(Rest$) = 0 Then Function = 0:Exit Function Cnt& = 0 For i% = 1 To ParseCount(Rest$,"\") Tmp$ = Trim$(Parse$(Rest$,"\",i%)) If Len(Tmp$) Then Incr Cnt&:ReDim Preserve DirPath(1 To Cnt&) DirPath(Cnt&)=Tmp$ End If Next i% If Cnt& = 0 Then Function = 0:Exit Function '--Skapa biblioteken----------------------------- On Error Resume Next Rest$ = Left$(Root$,Instr(-1,Root$,"\")-1) For i% = 1 To Cnt& Rest$ = Rest$ & "\" & DirPath(i%) Call CreateDirectory(ByVal StrPtr(Rest$),ByVal %NULL) Next i% End If Function = FSO_FolderExists(PathSpec$) End Function Function FSO_CopyCDFile(ByVal SrceFile$,ByVal DestFile$,ByVal OverWrite&)As Long Local DestDir$ DestDir$ = Left$(DestFile$,Instr(-1,DestFile$,"\")) If IsFalse FSO_CreateFolder(DestDir$)Then Function = 100:Exit Function End If If IsFalse CopyFile(ByVal StrPtr(SrceFile$), _ ByVal StrPtr(DestFile$), _ OverWrite&) Then Function = GetLastError Exit Function End If If IsFalse SetFileAttributes(ByVal StrPtr(DestFile$), _ %FILE_ATTRIBUTE_NORMAL) Then Function = GetLastError Exit Function End If Function = 0 End Function Function PbMain()As Long Print fso_copycdfile("D:\SETUP.HLP","C:\!!!XXX\SETUP.HLP",1) waitkey$ End Function
CHDRIVE szDestination IF Exist(szDestination) = 0 THEN MKDIR szDestination
ret& = CopyFile(sourcepath, destpath, %NULL)
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: