Loading

vb6.0 command prompt

7 posts / 0 new
Last post
Offline
Joined: 09/10/2009
vb6.0 command prompt

how can we write a program in vb6.0 to open the command prompt and type the string below
bin2text test.jpg test.text 200 vbCrLf

this is a command to convert image to text file

after that i want to load the file and display in text box

expert please help here.

admin's picture
Offline
Joined: 11/14/2008
re: vb6.0 command prompt

Try this:

Shell "bin2text test.jpg test.txt 200 vbCrLf"

After you execute the shell function use the code below:

  1. Dim nFileNo As Integer, sText As String, sNxtLn As String, lLineCnt As Long
  2.  
  3. Private Sub Command1_Click()
  4.  
  5. nFileNo = FreeFile
  6.  
  7. Open "test.txt" For Input As nFileNo
  8. lLineCnt = 1
  9.  
  10. Do While Not EOF(nFileNo)
  11. Line Input #nFileNo, sNxtLn
  12.  
  13. sNxtLn = sNxtLn & vbCrLf
  14. sText = sText & sNxtLn
  15.  
  16. Loop
  17. Text1.Text = sText
  18.  
  19. Close nFileNo
  20.  
  21. End Sub
Offline
Joined: 09/10/2009
get text

Hai admin i got problem with the code you provided!
The error i got is 53 at the Open "test.txt" For Input As nFileNo and Dim nFileNo As Integer

can help me solve this @@?

admin's picture
Offline
Joined: 11/14/2008
re: get text

Change the path that points to your test.txt file.

Offline
Joined: 09/10/2009
admin

TQ u have solve my 1st nightmare , the second nightmage i facing is , how can we take each paragraft and save as a Dim XXX as long,

For example, the test file consist of more than 12 paragraft and each of it having a newline at the end , so how can we separate it and save in a variable or using array mathod....because i want use each of the paragraft to send MMS. For sending MMS i have to upload 1 by 1 paragraft until the end of the paragraft, only i use a command to regenate this code to picture to send to user. Dun bother the MMS function i just give u the idea......Thx for helping

example of my long text file
ffd8ffe000104a46494600010101007800780000ffe1001645786966000049492a00080
00000000000000000ffdb004300080606070605080707070909080a0c140d0c0b0b0c
1912130f141d1a1f1e1d1a1c1c20242e2720222c231c1c2837292c30313434341f273
93d38323c2e333432ffdb0043010909090c0b0c180d0d1832211c213232323232323
2323232323232323232323232323232323232323232323232323232323232323232
32323232323232323232ffc000110800540070030122000211010311

01ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc
400b5100002010303020403050504040000017d01020300041105122131410613516
107227114328191a1082342b1c11552d1f02433627282090a161718191a2526272829
2a3435363738393a434445464748494a535455565758595a636465666768696a7374
75767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3
b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3

e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000
000102030405060708090a0bffc400b511000201020404030407050404000102770001
02031104052131061241510761711322328108144291a1b1c109233352f0156272d10
a162434e125f11718191a262728292a35363738393a434445464748494a5354555657
58595a636465666768696a737475767778797a82838485868788898a929394959697
98999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4

and so on!!!

last paragraft is few only

02061d6aae28a298c9046188fe95a50c48b1a003b679a28a0448bc74a764edcd145202
1910139ef4d42538078f7a28a7d0435ee644e98aad25ecc4e3701f414514219fffd9

admin's picture
Offline
Joined: 11/14/2008
re: admin

Try this:

  1. Dim strArray() As String
  2.  
  3. strArray = Split(cDataReceived, chr(13)) 'replace with 10 if 13 does not work.

You can now access the first value by reference an array like strArray(0), strArray(1), etc.

Offline
Joined: 09/10/2009
VB command prompt

at the open function there i got a error 53 ...can you help me on this?

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.