Solved

VB6 Shell function works in ide but not in exe

Posted on 2014-01-31
8
582 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 44

Expert Comment

by:AndyAinscow
Comment Utility
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 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 166 total points
Comment Utility
>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 45

Assisted Solution

by:aikimark
aikimark earned 167 total points
Comment Utility
Does the makefile.exe proper execution depend on the current directory?  If so, that should be part of the batch file.
0
 
LVL 27

Assisted Solution

by:Ark
Ark earned 167 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:IT-Ed
Comment Utility
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
Comment Utility
Okay, solved the problem by adding a ChDrive "c" statement before executing makecab.exe
0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
@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
Comment Utility
Problem solved...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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.  …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now