-
1 Attachment(s)
If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto line 1
Dear Members of this forum.
I am working on a loop to work just like this:
Code:
IF LOF=End then play state media file
IF LOF=Not End then goto 1
!! Thanks in advance !!
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
What's your question? What part of this do you need help with?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
When LOF is finished loading in the data, then either goto 1 or goto 2, line numbers of source code...
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
Dear Members of this forum.
I am working on a loop to work just like this:
Code:
IF LOF=End then play state media file
IF LOF=Not End then goto 1
!! Thanks in advance !!
You should know this by now, but please just post the relevant code and not a zip of the entire project.
Is LOF the same as this https://learn.microsoft.com/en-us/of...p/lof-function function? If so the two lines you have posted make no sense. In fact those two lines aren't anything like a loop. What on earth are lines 1 and 2 anyway?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
-- Sorry for not making sense, like...
I am trying to make it like this:
I am looking for the code to loop through then LOF until it has been fully loaded into the String. Then if the LOF isn't fully loaded, it then goto 1. Back to the beginning of the routine. Then if and only when the LOF is fully loaded it goto 2. If LOF isn't fully loaded and still it is loading into the String. Then it will exit the routine, as what i am looking to work with here, like so.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
-- Sorry for not making sense, like...
I am trying to make it like this:
I am looking for the code to loop through then LOF until it has been fully loaded into the String. Then if the LOF isn't fully loaded, it then goto 1. Back to the beginning of the routine. Then if and only when the LOF is fully loaded it goto 2. If LOF isn't fully loaded and still it is loading into the String. Then it will exit the routine, as what i am looking to work with here, like so.
So you want to read the contents of a file into a string variable?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Sounds like a basic File IO loop?
Code:
Dim fID As Integer
Dim sLine As String
fID = FreeFile
Open "c:\myfile.txt" For Input As fID
Do Until EOF(fID)
' No need for goto 1, do your "1" thing here
Line Input #fID, sLine
Loop
Close fID
' The file has been processed, not need for goto 2
' Do your "2" thing
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Actually i am already reading the file contents, but not sure how to check for file operations of begin, running and stopping reading processes
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
Actually i am already reading the file contents, but not sure how to check for file operations of begin, running and stopping reading processes
So you are already reading file contents, but you don't know when you are starting, reading, and stopping this process?
Could you explain what you want the end result to be, rather than this convoluted goto 1 / goto 2 idea you have?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Code:
Dim fID As Integer
Dim sLine As String
Dim lLineCnt As Long
fID = FreeFile
' The beginning, opening the file
Open "c:\myfile.txt" For Input As fID
' Check if we reached the end of the file, if not then read the next line
Do Until EOF(fID)
' The processing of the file content is in the Do .. Loop
' Read the next line
Line Input #fID, sLine
' Increase a line counter
lLineCnt = lLineCnt + 1
If lLineCnt = 1 Then
' The first line of the file has been read
End If
Loop
' The file has been processed, now close the file
Close fID
' Check if the last line was empty, if it is then substract 1 from the line counter
If Len(sLine) = 0 Then lLineCnt = lLineCnt - 1
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Would this source code snippet work, right like this:
Code:
Dim a As Integer
Do Until EOF(a)
WMP.PlayState = True
Loop
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
No need to set the PlayState for every file IO statement
Just set once before and after the the file IO.
Code:
Dim fID As Integer
Dim sLine As String
Dim lLineCnt As Long
fID = FreeFile
' The beginning, opening the file
Open "c:\myfile.txt" For Input As fID
' Set the PlayState to True during the File reading
WMP.PlayState = True
' Check if we reached the end of the file, if not then read the next line
Do Until EOF(fID)
' The processing of the file content is in the Do .. Loop
' Read the next line
Line Input #fID, sLine
' Increase a line counter
lLineCnt = lLineCnt + 1
If lLineCnt = 1 Then
' The first line of the file has been read
End If
Loop
' The file has been processed, now close the file
Close fID
' Check if the last line was empty, if it is then substract 1 from the line counter
If Len(sLine) = 0 Then lLineCnt = lLineCnt - 1
' Set the PlayState to False, because we finished the file reading
WMP.PlayState = False
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
I forgot to add the loadfile location process, like so
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
I don't understand what you mean.
English is not my native language and maybe not yours either, so please rephrase your reply.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Code:
WMP.URL = "C:\Video-1234567890.flv"
WMP.PlayState = True
Is this correct or not so, even???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Looks okay to me.
But I don't see how this is related to your File IO question..
Can you explain?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
I'm not into VB6. Just here because ThEiMp posted. :bigyello:
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
ThEiMp, have you ever coded in VB.NET?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
sure, but then it's not my slice of cake, as per say
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Right, this is what my source code looks like, now so:
Code:
Private Sub UserControl_Initialize()
On Error Resume Next
Dim a As Integer
Dim Item1 As String
a = 0
With UserControl
.lstPlay.Selected(0) = True
End With
a = a + 1
Item1 = UserControl.CustomDialog1.Data
With UserControl
.SSTab.Tab = 0
End With
With UserControl.CustomDialog1
.Action = 2
.Data = (StrConv(LoadResData("SEASON1", "EP" & a), vbUnicode))
.FileName = "Video1234567890.flv"
.Path = "C:\"
End With
With UserControl
Item1 = .CustomDialog1.Data
End With
Open ("C:\Video1234567890.flv") For Input As #1
Do Until EOF(a)
Line Input #1, Item1
Loop
Close #1
Open ("C:\Video1234567890.flv") For Output As #1
Do Until EOF(a)
Print #1, Item1
Loop
Close #1
With UserControl
.WMP.openPlayer ("C:\Video1234567890.flv")
.picBox.Visible = False
End With
Item1 = ""
End Sub
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
The indentation in your code looks good.
Beyond that, not sure what you want from us. That code is like someone saying they want to build a house, so they do jazz hands for 10 minutes and then wonder why the house isn't built.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
The Visual Basic IDE is hanging when i add the OCX to the Project1 of mine. I am just testing the OCX out in VB6, not sure what is going on here. But it looks good, because it's using about: 28.6Mb memory and about: 54.6% CPU, not much else to report there, so like now. Where am I going wrong in the source code, as to where the OCX is hanging, like???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Almost everything is wrong in the UserControl_Initialize..
But because of your On Error Resume Next it's all ignored
Code:
Private Sub UserControl_Initialize()
'------------ Remove this line to get a lot of errors when running
On Error Resume Next
Dim a As Integer
Dim Item1 As String
a = 0
With UserControl
.lstPlay.Selected(0) = True
End With
a = a + 1
Item1 = UserControl.CustomDialog1.Data
With UserControl
.SSTab.Tab = 0
End With
With UserControl.CustomDialog1
.Action = 2
'------------ What type of variable is .Data ? And what is stored in it?
.Data = (StrConv(LoadResData("SEASON1", "EP" & a), vbUnicode))
'------------
.FileName = "Video1234567890.flv"
.Path = "C:\"
End With
With UserControl
'------------ Now you assign the CD content to the string variable Item1
Item1 = .CustomDialog1.Data
'------------
End With
Open ("C:\Video1234567890.flv") For Input As #1
'------------ In this loop you read the content of a BINARY file to a string
'------------ You are again using Item1, which you just filled with content of de CD
'------------ The content of Item1 is also overwritten by each Line Input
Do Until EOF(a)
Line Input #1, Item1
Loop
Close #1
'------------ By opening the same file for Output you open the file in text mode and it will be overwritten with new data
'------------ You can't write a file with a EOF loop! That's only for reading
Open ("C:\Video1234567890.flv") For Output As #1
Do Until EOF(a)
Print #1, Item1
Loop
Close #1
With UserControl
'------------ This will fail because you ruined the file
.WMP.openPlayer ("C:\Video1234567890.flv")
.picBox.Visible = False
End With
Item1 = ""
End Sub
So you are filling Item1 with content from the CD.
Then you open an existing FLV file (which is a binary file, not a text file) and you assign a part of the content again to Item1
Which will be overwritten in the loop
Then you open the FLV file again and write the content of Item1 to it.
Don't change your code, but first answer the main question:
Why would you open a file, read the file to some variable and the write the content back to the same file???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
Right, this is what my source code looks like, now so:
Code:
With UserControl.CustomDialog1
.Action = 2
.Data = (StrConv(LoadResData("SEASON1", "EP" & a), vbUnicode))
.FileName = "Video1234567890.flv"
.Path = "C:\"
End With
Why are you trying to convert the presumably binary data into a string before putting it into the .Data property? Why are you trying to save directly to the root of the C: drive?
Quote:
Originally Posted by
ThEiMp
Right, this is what my source code looks like, now so:
Code:
With UserControl
Item1 = .CustomDialog1.Data
End With
Open ("C:\Video1234567890.flv") For Input As #1
Do Until EOF(a)
Line Input #1, Item1
Loop
Close #1
Open ("C:\Video1234567890.flv") For Output As #1
Do Until EOF(a)
Print #1, Item1
Loop
Close #1
Think about what is going on in these bits of code....
1. Why use a With ... End With to set a single property?
2. You are assigning the .Data property to item1
3. You are immediately trying to read the flv file, a line at a time and overwriting item1 in a loop. But you are using EOF(a) to detect the end of the file, but the variable a isn't the file handle you are using to read from.
4. Assuming step 3 actually works you now have item1 containing only the last line of the .flv file.
5. You are now opening the same file you tried to read in step 3 and attempting to write the contents of the item1 variable to the file. Think about this, why try to read the file contents into a variable and then immediate write the variable back into the same file? Again you are using EOF(a) when a isn't the file handle, plus EOF only makes sense when reading a file.
Have you even tried to debug this code? Put a breakpoint at the start of the routine and step through it line by line to see what happens.
Writing code isn't a matter of just typing stuff and hoping for the best, you need to figure out what you are trying to do and the steps to achieve this.
Could you try to explain what you are attempting to achieve, and more importantly how the code you have written is fitting in with your aims?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Well actually i have to pass over the data from the CustomDialogBox to be read, then Saved as a Binary file. This part is working, it took me about Forty-Five hours last night to work out ten bytes from the string data file. So then it works, just very damn slowly, then so
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Glad you fixed it, but I can't see how it can be very slow
Quote:
i have to pass over the data from the CustomDialogBox to be read, then Saved as a Binary file
You mean selecting a file with the CustomDialogBox and then copying it to a different location?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Not quite so, like that. But it interpreters a file from binary to ambra sequencing
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Sorry , but the logic you use is completely incorrect.
I’ve been trying to help you with your videoplayer for a few years, but you really don’t have a clue what you’re doing .
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Actually it's a hard thread of a time. because of the problem of rehashing the data files, which i have been able to rehash. but takes like many hours to work through it, so. then the problem that i have no so, is the command to load and play the video file. the video extension that i have chosen to work with is: FLV. Can someone please help me with the command to load and play the video using WindowsMediaPlayer???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
Not quite so, like that. But it interpreters a file from binary to ambra sequencing
I'll take the bait. What is Ambra sequencing?
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
I named the type of processing sequencing after my surname, LOL. I wasn't sure on what to name it, so???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
@TS is convinced that a basic hash algorithm he used on a movie file can be used to recreate the original file.
https://www.vbforums.com/showthread....-of-some-sorts
https://www.vbforums.com/showthread....hEiMp-has-done
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
Actually it's a hard thread of a time. because of the problem of rehashing the data files, which i have been able to rehash. but takes like many hours to work through it, so. then the problem that i have no so, is the command to load and play the video file. the video extension that i have chosen to work with is: FLV. Can someone please help me with the command to load and play the video using WindowsMediaPlayer???
Nothing in your posted code is doing anything other than reading and writing to the same file and reusing the same variable to do it.
At no point do you ever attempt to either explain what you think your code is doing, or how it relates to what you want it to do. You have repeatedly posted this same pointless snippet in multiple threads and ignored just about all the advice or comments made.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
This is not even funny anymore.
Some people decide they are better nowadays and stop taking their medications for whatever mental illness they suffer from and so things quickly explode after some point of no return.
Don't laugh, don't mock and don't reply. It's sad but there is nothing you can do. I'm deeply sorry seeing this repeat pattern in vbforums after months of relapse.
cheers,
</wqw>
-
1 Attachment(s)
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Here is my source code on my hash ActiveX Control Object:
-
2 Attachment(s)
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Right then and there we go. I have been able to write the finishing details of my app, using: Visual Basic 6.00, then here it is in the attachment section of this post, then so...
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
This was already discussed in 2018:
https://www.vbforums.com/showthread....=1#post5331577
The old thread mention is from 2010...
Quote:
Originally Posted by Arnoutdv
I downloaded the project, read the source code and there is no compression or whatsoever, only basic encryption.
The encryption is a one-to-one copy of this old thread where you were asking for encryption source samples:
http://www.vbforums.com/showthread.p...=1#post3825485
Code:
Option Explicit
Private baLUT(255) As Byte, backLUT(255) As Byte '0 to 255, aka ANSI/ASCII
Private Sub InitLUT()
Dim X As Long, Y As Long, bChr As Byte
'initialize LUT array with unique values
For X = 0 To 255
baLUT(X) = X
Next X
'randomly shuffle array
Rnd -1 'reset the rnd generator
Randomize 1234 'use a number here for the random seed, ensuring repeatable output
'these two random calls ensure that the follow sequence of RNDs will be the same
For X = 1 To 255
Y = Int(X * Rnd)
If X <> Y Then
bChr = baLUT(X)
baLUT(X) = baLUT(Y)
baLUT(Y) = bChr
End If
Next X
For X = 0 To 255
backLUT(baLUT(X)) = X
Next X
End Sub
Private Sub FXInCipher(strIn As String, bOutString() As Byte)
Dim X As Long
Dim bString() As Byte
bString = strIn
ReDim bOutString(UBound(bString))
For X = 0 To UBound(bString)
bOutString(X) = baLUT(bString(X))
Debug.Print bString(X) & ">" & bOutString(X) & ",";
Next X
End Sub
Private Function FXDeCipher(strIn() As Byte) As String
Dim X As Long
Dim bString() As Byte
Dim bOutString() As Byte
bString = strIn
ReDim bOutString(UBound(bString))
For X = 0 To UBound(bString)
bOutString(X) = backLUT(bString(X))
Debug.Print bString(X) & "<" & bOutString(X) & ",";
Next X
FXDeCipher = bOutString
End Function
This code is 4 of the 5 forms.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
If you know all of this and you have been working since 2010 on this project then you must be doing something wrong.
Look at the post #35 by PlausiblyDamp, your only reaction is posting the same code over and over
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Today: I have been able to look through my source code for my Windows App, which it just points to the Input command of the Open & Close file I/O, type of thing. I have to find out how to cache somehow the data into the expanding files, with the file extension FLV, which is Flash Video Files, for Windows/MAC, etc such things as that one...
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Can someone please help me with the source code to play a video in windowsMediaPlayer ActiveX Control Object. I have used he WMP.URL command, which i have setup for C:\Video12234.FLV. Then what else must i do for running it. Like there must be an automatic play button or process to run, like so right???
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Code:
Private Sub Form_Click()
With WindowsMediaPlayer1
.URL = "C:\Video12234.FLV"
.Controls.play
End With
End Sub
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Quote:
Originally Posted by
ThEiMp
the video extension that i have chosen to work with is: FLV.
ThEiMp, no one uses the FLV video file format. You should be working with MP4s.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
FLV is not even supported by the WindowsMediaPlayer, unless you download some exotic codec packs.
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
and I have loaded a special codec to do such a thing, well dudes
-
Re: If LOF = Finshed input into box, then exit sub, if LOF not Finished then goto lin
Now i have to make the making the file as Binary and then not as Input or Output File I/O.