CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2008
    Posts
    5

    Lightbulb Copying of the text from other programs (sorry for lang)

    Help please, how it's possible to deduce in Textbox1.text the text which will be deduced in dos window or in a command line when by pressing the button "button1" this program will be started or *.cmd file

    Help with a code

  2. #2
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,900

    Re: Copying of the text from other programs (sorry for lang)

    If I understand,

    You want to transfer some data from a DOS Command Line to a VB Program into Text1 textbox when you click on a Command Button in your VB program ?

    Can you upload a picture of what is being displayed in the DOS CMD Program

  3. #3
    Join Date
    Nov 2008
    Posts
    5

    Re: Copying of the text from other programs (sorry for lang)

    Quote Originally Posted by George1111 View Post
    If I understand,

    You want to transfer some data from a DOS Command Line to a VB Program into Text1 textbox when you click on a Command Button in your VB program ?

    Can you upload a picture of what is being displayed in the DOS CMD Program
    You are right. The picture is not necessary. First program is converting files and text is updated everyone 500 msec like this:

    Converting PATH/FILE.EXT 1% - after 500 msec it will be : Converting PATH/FILE.EXT 2% and so on

    Second program must show this process in textbox. Timer will be refresh textbox1.text every 500 msec.

    It will look as textbox1.text=DATA FROM Program1 window

    P.S I prefer VB.Net but in this situation i also can use VB 6.0. If you like, help me for vb.net code
    Last edited by 0Ewil0; November 28th, 2008 at 05:12 PM.

  4. #4
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,900

    Re: Copying of the text from other programs (sorry for lang)

    If we dont need a picture, how are we to understand what is on the screen - after all it is just a dos screen which looks like a page of text

    I am not psychic (although I am trying)

    Perhaps other people can "guess" what is on the screen

    And then guess exactly what you want to retrieve from it

    I cant help you, sorry

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Copying of the text from other programs (sorry for lang)

    You have one program processing files, and outputting twice per second, and you want another program to read the text file? At the same time?

    That is happening pretty quickly, and if you're doing any processing at all, it will take time.

    You could append to the same text file, and read the last line every second.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Nov 2008
    Posts
    5

    Re: Copying of the text from other programs (sorry for lang)

    Look the attached file, I guess you will understand now what I mean
    Attached Images Attached Images  

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Copying of the text from other programs (sorry for lang)

    Just have the SECOND program convert the files,and you can show the percentage complete a lot easier that it would be to monitor it using another program.

    Who wrote the first program? If it's writing to the screen, it should be able to write to a text file at the same time.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Nov 2008
    Posts
    5

    Re: Copying of the text from other programs (sorry for lang)

    Quote Originally Posted by dglienna View Post
    Just have the SECOND program convert the files,and you can show the percentage complete a lot easier that it would be to monitor it using another program.

    Who wrote the first program? If it's writing to the screen, it should be able to write to a text file at the same time.
    First program is not my, this program isn't saving text into text file, only print in windows

  9. #9
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Copying of the text from other programs (sorry for lang)

    You'd have to intercept messages sent by that app. That is a pretty advanced area, and nobody else's code would work with your app. Search for SPY++, and you'll see posts from others about sendmessage
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,900

    Re: Copying of the text from other programs (sorry for lang)

    From what I can see, you have a DOS program running in the background, converting A NUMBER OF BMP files to JPG Format.

    I would have thought that you are more interested in the names of the files being converted rather than the percentage complete

    Unless your BMP files are SEVERAL MEGABYTES in size, the conversion percentage would hardly have time to display, let alone be meaningful

    And so what if a particular file is 20% or 53% converted, when the full conversion time probably is less than 500ms per conversion

    If the % complete per file is your whole desire in life, then TOTALLY IGNORE THE REST OF THIS POST


    I imagine the final result you want is to know how long a big conversion process will take (not how long each individual file conversion will take)

    You could check the directory for the number of files

    eg, 5125 files to be converted

    You then start the DOS process running and a TIMER starting at the same time
    (The TIMER trips over MINUTES and HOURS as it progresses)
    Your destination directory is EMPTY to start with

    You now simulate what MS does in a Copying Dialogue

    1) Check how many files have been converted
    2) Check the Time taken

    Use this AVERAGE as the time it will take for each file

    Display a) Time Taken and % Complete in your OWN program
    b) Time left to go (estimated - but will become more accurate, the more files are converted)

    If you have a facination with the % taken per file you could also calculate the time it takes to convert a BMP of various size and use your own timer to calculate % done (or left to go) because you know which file in the list is going to be converted next

    If you are only converting ONE FILE at a time, dont blink because you may miss the % complete

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Copying of the text from other programs (sorry for lang)

    IF that's all it's doing, you could easilydo the same thing in VB.

    As far as the File Watcher, that's a class in VB.Net, which fires each time the folder changes.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured