Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 Shell function works in ide but not in exe

Posted on 2014-01-31
8
Medium Priority
?
604 Views
Last Modified: 2014-02-07
I have a simple VB program to make CAB files using the makefile.exe utility that ships with windows.  The program runs without error and makes the cab files specified when I run it through the IDE. When I compile it, the makefile.exe utility fails to make the cab files but does not show any errors.  I tried the built in VB shell function, and the ShellExecute API with the same results.  To debug, I wrote a batch program in the application with a pause command after the makecab.exe command to see what is happening.  The makefile.exe seems to run and displays the same output that I see when I run it manually from a cmd prompt, it just does not make the cab file.

dim i as integer
i = FreeFile
Open "C:\DIRS\RMakeCab.bat" For Output As #i
Print #i, "@echo off"
Print #i, "cls"
Print #i, "call makecab.exe /f  " & "C:\DIRS\dirsends.ddf"
Print #i, "pause"
Close #i

dim x as long
x = ShellExecute(Me.hwnd, "", "C:\DIRS\RMakeCab.bat", "", "", SW_HIDE)
'x = Shell("makecab.exe /f  " & dirsends.ddf", vbHide) 'tried both...

Any ideas on what I'm missing here would be greatly appreciated...
0
Comment
Question by:IT-Ed
8 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 39826268
Two things I can suggest.
First don't use the 'hide' whilst testing - maybe you see some feedback with that about a problem
second try \\ instead of \
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 664 total points
ID: 39826334
>it just does not make the cab file.
I think it actually DOES the cab file, but maybe not in the folder you think it does ...
please check if the cab file is created in the folder where makefile is located ...
0
 
LVL 46

Assisted Solution

by:aikimark
aikimark earned 668 total points
ID: 39826377
Does the makefile.exe proper execution depend on the current directory?  If so, that should be part of the batch file.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 28

Assisted Solution

by:Ark
Ark earned 668 total points
ID: 39827161
The makefile.exe seems to run and displays the same output that I see when I run it manually from a cmd prompt,
It's strange because you include @echo off command into bat file. And second, you must specify path to the  dirsends.ddf in VB Shell function:
x = Shell("makecab.exe /f  " & "C:\DIRS\dirsends.ddf", vbHide)
0
 

Author Comment

by:IT-Ed
ID: 39828724
From further testing I've discovered that it has nothing to do with the VB IDE or the paths in the code, I am running the exe from a mapped network drive.  When I compile it locally it works fine, I need it to run from the mapped drive for several users so I still need to figure  out a way to get to run from the network drive...
0
 

Accepted Solution

by:
IT-Ed earned 0 total points
ID: 39828738
Okay, solved the problem by adding a ChDrive "c" statement before executing makecab.exe
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39829976
@IT-Ed

I think it would be better to accept the comments from Ark and aikimark, as these are the comments related to the path and current directory at run time.

Including your comment, http:#a39828738 , should be your closing/accepting comment.
0
 

Author Closing Comment

by:IT-Ed
ID: 39841396
Problem solved...
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question