|
-
Mar 22nd, 2007, 06:36 AM
#1
Thread Starter
Hyperactive Member
a call for loads
The biggest challenge in my VB6 to HTML project is handling file input. the open file commands don't work on the internet, so they must be remapped using javscript.
i would like to ask anyone with an extra moment or two to please paste the routines they use to get a string or binary chunck from a file.
the more examples i can see, the better i can write the conversion code.
I'm sorry to see microsoft abandoning VB6, so i want to bring into the 21st century; giving it new life as a web language.
but i'm stuck on the file input, so please post some, any, and all, good and bad.
Thanks you guys.
-
Mar 22nd, 2007, 03:50 PM
#2
Re: a call for loads
If you mean use a VB program on your computer to open a file on a remote server on the internet, you can't use file IO, you have to use the INet or the Winsock control. The only way to use file IO would be to establish a VPN between you and the remote server, and you don't do that in VB.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 22nd, 2007, 08:38 PM
#3
Thread Starter
Hyperactive Member
Re: a call for loads
 Originally Posted by Al42
If you mean use a VB program on your computer to open a file on a remote server on the internet, you can't use file IO, you have to use the INet or the Winsock control. The only way to use file IO would be to establish a VPN between you and the remote server, and you don't do that in VB.
no. thats not what i mean at all, i wrote mypost right before i went to bed, so its probably unclear.
the project is:
you take you .vbp, .frm, and .frx files, and my app converts them to an html page that anyone can use from anywhere.
i had origionally wanted to turn the vb code into javascript, but the problem with that is this:
is "days(3)" a function or an array vari?
so, for now, vbscript performs the code logic, and javascipt remaps the control methods (like .additem).
let me give you an example or two of some of the steps involved:
Dim QbColor(15):QbColor(0) = "#000":QbColor(1) = "#088883":QbColor(2) = "#687632":QbColor(3) = "#762184":QbColor(4) = "#28812":QbColor(5) = "#368883":QbColor(6) = "#968932":QbColor(7) = "#566312":QbColor(8) = "#042184":QbColor(9) = "#807116":QbColor(10) = "#802865":QbColor(11) = "#607716":QbColor(12) = "#55525":QbColor(13) = "#357116":QbColor(14) = "#355365":QbColor(15) = "#157716"
function Command()
Command = unescape(location.hash)
End Function
case "OptionButton":
this.ctag="\/>";
th="<input type=\"radio\" ";
try{ var p1 = trim(cntStr.split(/Value.*\=\ /g)[1]).substr(0,1) } catch(e){ var p1=0 };
switch (p1) //value of checkbox
{ case 0: th+= ""; break
case 1: th+= "checked=\"checked\" "; break
case 2: th+= "enabled=\"0\" "; break }
var tid=cntStr.split(" ")[1]; // id for cntrl
th+= "id=\""+tid+"\" name=\""+tid+"\" ";
if (CR[z].toString().indexOf("_MouseMove") >1){bootstrap+="set document.forms(0)."+funN+".onmousemove=getref(\""+funN+"_MouseMove\" ) \n"}//end if mm event
if (CR[z].toString().indexOf("_DblClick") >1){bootstrap+="set document.forms(0)."+funN+".ondblclick=getref(\""+funN+"_DblClick\" ) \n"}//end if dc event
if (CR[z].toString().indexOf("_KeyDown") >1){bootstrap+="set document.forms(0)."+funN+".onkeydown=getref(\""+funN+"_KeyDown\" ) \n"}//end if kd event
basically: form goes in, html webpage + vbscipt javascript comes out.
ok, so it's not universal. there's obvoiusly not going to be any API stuff, although some things could be remapped.
i have the graphical .frm to html pretty much done, and it works well. i like how browser's resize the form a lot better than vb6 did!
anyways, this is what i'm looking for:
Public Function LdFile(lFileName As String) As String
Dim F As Integer
F = FreeFile
Open lFileName For Input As #F
LdFile = Input$(LOF(F), F)
Close #F
End Function
Open "filename.txt" For Input As #1
While Not EOF(1)
Redim Preserve MyArray(i)
Line Input #1, MyArray(i)
i = i +1
Wend
Open "myfile.txt" For Output As #1
Print #1, Join(MyArray, vbcrlf)
Close #1
Dim Char As String * 1
Open "filename.txt" For Input As #1
While Not EOF(1)
Char = Input$(1,#1)
Wend
and so on.
as you can see there are lots of ways this works, so please give me some more examples. even if what you use is "pretty much like" something alreasy posted, uplaoed it anyway! the smallest differerence can make all the difference.
thanks!
oh, and this project is going to be open sources, and examples will follow soon.
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
|