|
-
Oct 16th, 2000, 04:13 AM
#1
Thread Starter
Frenzied Member
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
-
Oct 16th, 2000, 05:32 AM
#2
Frenzied Member
yes it is possible!
I hesitate to post the code though because it could be used on the hard-drive as well!
-
Oct 16th, 2000, 06:13 AM
#3
A simple DOS command would do it .
Code:
Shell "Command.com Format A:", vbHide
'or is it:
'Shell "Format A:", vbHide ?
-
Oct 16th, 2000, 06:42 AM
#4
Frenzied Member
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!
-
Oct 16th, 2000, 06:51 AM
#5
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 .
-
Oct 16th, 2000, 07:03 AM
#6
Frenzied Member
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
-
Oct 16th, 2000, 07:27 AM
#7
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!
-
Oct 16th, 2000, 07:54 AM
#8
Frenzied Member
that doesn't work either RobIII
not on my NT4 pc anyway
My (secret) method works a treat though! 
-
Oct 16th, 2000, 07:59 AM
#9
Well, you could always KILL al files... ???
-
Oct 16th, 2000, 08:02 AM
#10
_______
<?>
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
-
Oct 16th, 2000, 10:21 AM
#11
Addicted Member
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.
-
Oct 16th, 2000, 10:37 AM
#12
Frenzied Member
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
-
Oct 16th, 2000, 11:20 AM
#13
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!
-
Oct 16th, 2000, 04:57 PM
#14
Thread Starter
Frenzied Member
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
-
Oct 17th, 2000, 02:11 AM
#15
Frenzied Member
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!
-
Oct 18th, 2000, 03:09 AM
#16
Thread Starter
Frenzied Member
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
-
Oct 18th, 2000, 04:09 AM
#17
transcendental analytic
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.
-
Oct 19th, 2000, 05:03 AM
#18
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|