Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 515
  • Last Modified:

Quick quesion re: Shell command in vbHide mode

I am using the shell command to zip up a db file in a DOS window.  When running it in vbNormalFocus mode the DOS window does not close after the file has been zipped.

If I change it to vbHide so that the DOS window does not pop up will a process still be running in the background that I will have to worry about closing after the zip is complete or no?

Thanks
0
bsmiley
Asked:
bsmiley
  • 3
  • 2
  • 2
  • +5
1 Solution
 
JonFish85Commented:
vbHide will just hide its execution I believe... You will probably have to close it manually... Listening for other experts' advice...
0
 
KDivadCommented:
Yes, it will still be in the background.

If this app is for personal use:
Right-Click your zip exe (pkzip?) and select properties. On the "Program" tab, select "Close On Exit". Click OK.
0
 
KtoshniCommented:
I have a small VB program which does something similar. However I use the Winzip command line utilities to zip/unzip files. When the operation completes there will be no processes left in memory. The only problem I have encountered is that if there is a problem with the zip file you wouldn't realise that something happened - your program would just lock up. Maybe you could find a work around for this. As such I haven't had the chance to check it out. Go to www.winzip.com and you'll find the command line utilities available for download. Please note though you'll need Winzip installed too.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
KDivadCommented:
The work-around is easy enough. You launch a tiny app that just starts the command-line utility. Use the Shell-And-Wait method to launch it. WaitForSingleObject includes a timeout amount. Put in an appropriate timeout. For example, if the zip process will take 5 seconds then put 10. WaitForSingleObject will return when A. The process has ended or B. the timeout occurs. Check the return value and see if it timed out. If it did, then assume a lock-up and use TerminateProcess(?) to kill the "tiny app" you launched and the command-line.

I don't have the Shell-And-Wait method anymore...
0
 
netraLINKCommented:
HI bsmiley

Why not use a freeware 3rd party component to zip or unzip your files. E-Mail me if you want me to mail you one. Ive used the one I have extensively in the past and it works like a bomb. This way you do not have to rely on and external app running but rather just on creating an object and then closing it again to release all resources.

Lemme know

netraLINK
0
 
Nitin SontakkeDeveloperCommented:
Can you please post the single line of code in which you are using the shell command. I just want to have a look. I think there is a way to do it. But i would love to have a look first. If you don't mind.
0
 
Valliappan ANSenior Tech ConsultantCommented:
Try this:

Shell "C:\Command.com /C pkzip.exe zipfile zipspec"

Hope this helps.
0
 
Nitin SontakkeDeveloperCommented:
Exactly, I was going to suggest the same as "valli_an" has already suggested, after having a look at how "bsmiley" is using the Shell command.

I know for sure that the command given by "valli_an" will execute in background and will terminate automatically, as intended.

0
 
Richie_SimonettiIT OperationsCommented:
valli_an deserves the points, i think.
0
 
Nitin SontakkeDeveloperCommented:
Yes, of course. That's pretty natural, i suppose.
0
 
netraLINKCommented:
didnt know that decision lies with us. Lay off it guys... Although I agree with you, maybe its best to let bsmiley decide. I hate to get notices of question updates and its crap like this. It takes 5 minutes of my time to let go of my work and look at the comments....

thanks

netraLINK
0
 
Richie_SimonettiIT OperationsCommented:
netraLINK, i only said that, to me, that was THE answer, or puting in other words, that is the comment that i would post if i didn't get later to this thread.
No more no less.
Cheers
0
 
bsmileyAuthor Commented:
Thanks people!  That did the trick!
0
 
Valliappan ANSenior Tech ConsultantCommented:
Thanks all.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now