Results 1 to 18 of 18

Thread: format a floppy without the dialog box

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Does anybody know how it can be done?

    I have a good way to do it using windows dialog box.

    I just want to press a button and the a: formats, no forms, no questions.

    Possible?

    Thanks


    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    yes it is possible!

    I hesitate to post the code though because it could be used on the hard-drive as well!
    Mark
    -------------------

  3. #3
    Guest
    A simple DOS command would do it .

    Code:
    Shell "Command.com Format A:", vbHide
    'or is it:
    'Shell "Format A:", vbHide ?

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Did you try either of those Matthew?

    You'll find they don't work


    Like I say is is possible but, well, my reason stated before still applies!
    Mark
    -------------------

  5. #5
    Guest
    Your reason=DANGEROUS?
    I've formatted a floppy disk manually before, never through VB. And I have never formatted my hard drive simply because..I'm scared to. I found out that you need a disk or something in order to restore Windows, but I don't have it, so I can't format my computer at all.

    Sorry for the misunderstanding. The floor...is all yours, Mark .

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    my reason is that anyone reading a posting could write an exe which could format your hardrive without you wanting it to!

    Having said that it's trivial anyway and took me about 10 seconds to work out how to get around the fact that format wants you to press a key before continuing
    Mark
    -------------------

  7. #7
    Guest
    Though I might make some enemies right now, I think the solution is this:

    Code:
        Shell "command.com Format A: /autotest", vbHide
        ' or
        Shell "Format A: /autotest", vbHide
    The /autotest parameter specifies explicitly you don't want any questions... You could also add a /Q for Quick format and a /U for not saving Undo data.

    Don't try this at home kids! Also, I couldn't test it b'cause I'm running Win2000 Pro, wich doesn't support the /autotest paramater anymore....

    Hope I helped... Don't use it for any mean thing though....

    Enjoy!

    P.s. I usually make sure I have a backup of all my important files and sources... Everyone should do that!

  8. #8
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    that doesn't work either RobIII
    not on my NT4 pc anyway

    My (secret) method works a treat though!

    Mark
    -------------------

  9. #9
    Guest
    Well, you could always KILL al files... ???

  10. #10
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I fail to see why no dialog would be needed?
    If you are formatting a drive you certainly want to be there unless of course it's a backdoor format. As for a floppy...can you even buy an unformatted floopy anymore? And even at best, wanting to reformat an old floppy, you would need to be there to insert/remove the floppy anyway so who cares about a dialog box that is in place to help you out.





    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  11. #11
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134
    Mark Sreeves,

    I was wondering if there was such a func in VB for a long time. The only way I know how to do it (in an hard drive) doesn't let me format it if there is a doc open on it.

    Could you post here your func ?

    P.S. - There are a lot of more dangerous funcs posted in this bb.
    Jorge Ledo
    [email protected]
    Portugal were the sun allways shine... for programmers.

  12. #12
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    OK, my method was actually writing a batch file on the fly and shelling out to it.

    I haven't actually tried it on my hard drive though
    I just assumed it would work!

    Maybe I'm being over cautious.

    format requires a key press to continue so all I do is feed a file containing a carrage-return back into it

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim fnum As Byte
    Dim TempFile As String
    
    fnum = FreeFile
    TempFile = "C:\~~cr~~.tmp"
    Open TempFile For Output As fnum
    Print #fnum, vbCr
    Close fnum
    
    fnum = FreeFile
    
    TempFile = "C:\~vb~tmp~.bat"
    Open TempFile For Output As fnum
    Print #fnum, "format a: < c:\~~cr~~.tmp"
    Close fnum
    
    Shell TempFile, vbHide
    
    End Sub
    Mark
    -------------------

  13. #13
    Guest
    How about this then?

    Code:
    Shell "Command.com Echo Y| Format A:", vbHide
    The Echo command would send a "Y" and Enter to any question asked...

    Enjoy!

  14. #14

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Hey all.

    Mark, Rob, you guys really helped me out on that one. Anyway, since I started this thread, the whole idea was just to find a way to format a stack of floppies one after another as quickly as possible. Thanks to a combination of your codes, I can run one every 10 seconds now.

    Matthew, I can see what you mean, but the only people who ever use my software are friends and family. Even at Halloween, i wouldn't trick them into formatting their hard drives.

    Thanks again, everybody.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  15. #15
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    RobIII

    I realise this thread is fprobab;ly finished with now but,


    Shell "Command.com Echo Y| Format A:", vbHide

    didn't work for me!
    Mark
    -------------------

  16. #16

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Mark,
    your method does work great. But I have a couple of questions.

    First, the bat leaves something running each time the app is opened. The name is "winoldap". You can see that in the End Task window after you run the app. Then a whole string of them are running if I open and close the app a few times. Is there a way to either limit this to one, close it when the app closes, or automatically end task it within the application?


    Second, I found that this is doing a quick format. Is it possible to do a normal format?

    Thanks

    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  17. #17
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  18. #18

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Kedaman thanks for the link. But it still doesn't answer how to do the full format without showing the windows format dialog each time.

    Does anybody have this one figured out?

    Thanks
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

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